Skip to content

feat(tt): 抖音小程序 chooseVideo 支持 Promise 风格 #17397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fuxichen
Copy link

@fuxichen fuxichen commented Mar 6, 2025

这个 PR 做了什么? (简要描述所做更改)

字节跳动小程序 chooseVideo 支持 Promise 风格

(我另一个pr #17396 是基于 3.x 分支修改的,这个 pr 是基于 main 分支, 我不清楚是否要修改两个分支,还是需要从 3.x 分支合并进main分支)

这个 PR 是什么类型? (至少选择一个)

  • 错误修复(Bugfix) issue: fix #
  • 新功能(Feature)
  • 代码重构(Refactor)
  • TypeScript 类型定义修改(Typings)
  • 文档修改(Docs)
  • 代码风格更新(Code style update)
  • 其他,请描述(Other, please describe): 字节跳动小程序 chooseVideo api 兼容 Promise 风格

这个 PR 涉及以下平台:

  • 所有小程序
  • 微信小程序
  • 支付宝小程序
  • 百度小程序
  • 字节跳动小程序
  • QQ 轻应用
  • 京东小程序
  • 快应用平台(QuickApp)
  • Web 平台(H5)
  • 移动端(React-Native)
  • 鸿蒙(harmony)

Summary by CodeRabbit

  • 新功能
    • chooseMedia API 现已支持字节跳动小程序平台(tt)。
  • 文档
    • 更新了 chooseMedia API 的平台支持说明,新增对字节跳动小程序的支持标注。

This was referenced Mar 8, 2025
Copy link

coderabbitai bot commented Apr 30, 2025

Walkthrough

本次变更主要涉及对 chooseMedia API 的支持与声明。在 packages/taro-platform-tt/src/apis-list.ts 文件中,chooseMedia 被加入到需要基于 Promise 处理的 API 列表中。同时,在 packages/taro/types/api/media/video.d.ts 文件中,chooseMedia 的平台支持注释增加了 "tt"(头条小程序)平台。除此之外,没有涉及其他逻辑、接口或导出实体的更改。

Changes

文件/路径 变更摘要
packages/taro-platform-tt/src/apis-list.ts 将 'chooseMedia' 添加到 needPromiseApis 集合中,纳入 Promise 化处理。
packages/taro/types/api/media/video.d.ts chooseMedia 的 JSDoc 注释中增加 "tt" 平台支持标记。

Poem

小兔挥笔添新意,
chooseMedia 迎来 Promise 力,
头条平台也支持,
注释里悄悄加一笔。
API 列表再完善,
跳跃创新不停歇!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55457e3 and 83062ee.

📒 Files selected for processing (2)
  • packages/taro-platform-tt/src/apis-list.ts (1 hunks)
  • packages/taro/types/api/media/video.d.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-musl
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
  • GitHub Check: Build Rust WASM / stable - wasm32-wasi
🔇 Additional comments (2)
packages/taro-platform-tt/src/apis-list.ts (1)

6-6:

❓ Verification inconclusive

PR目标与修改不一致:添加了'chooseMedia'而非'chooseVideo'
PR 标题与目标聚焦于为抖音小程序 chooseVideo 提供 Promise 风格支持,但这里却新增了 chooseMedia。请确认是否遗漏将 'chooseVideo' 添加到 needPromiseApis 中,或者 PR 目标需更新为同时支持 chooseMedia

建议若需同时支持 chooseVideo,可参考如下 diff:

 export const needPromiseApis = new Set([
   'applyRefund',
   // ...
-  'checkFollowState',
-  'chooseMedia',
+  'checkFollowState',
+  'chooseMedia',
+  'chooseVideo',
   'continueToPay',
   // ...
 ])

🏁 Script executed:

#!/bin/bash
# 查看 needPromiseApis 列表及其中的 chooseMedia 和 chooseVideo
echo "===== needPromiseApis 内容 ====="
grep -R "needPromiseApis" -n packages/taro-platform-tt/src/apis-list.ts -A 50 | sed -n '1,50p'

echo ""
echo "===== 'chooseMedia' 出现位置 ====="
grep -R "'chooseMedia'" -n packages/taro-platform-tt/src/apis-list.ts

echo ""
echo "===== 'chooseVideo' 出现位置 ====="
grep -R "'chooseVideo'" -n packages/taro-platform-tt/src/apis-list.ts || echo "未找到 'chooseVideo'"

Length of output: 1115


PR 目标与实际修改不一致:新增的是 chooseMedia,而非 chooseVideo

packages/taro-platform-tt/src/apis-list.tsneedPromiseApis 列表中,确实只见到:

  'chooseMedia',

但并无

  'chooseVideo',

请确认您的 PR 意图:

  • 如果要为抖音小程序的 chooseVideo 增加 Promise 支持,应在 needPromiseApis 中补充 'chooseVideo'
  • 如果同时支持 chooseMediachooseVideo,也需在 PR 标题/描述中说明并修改列表。

建议补充的代码示例:

 export const needPromiseApis = new Set([
   'applyRefund',
   // …
-  'checkFollowState',
-  'chooseMedia',
+  'checkFollowState',
+  'chooseMedia',
+  'chooseVideo',
   'continueToPay',
   // …
 ])
packages/taro/types/api/media/video.d.ts (1)

505-508: 💡 Verification agent

🧩 Analysis chain

同步更新 chooseVideo 的平台支持注释
PR 目标同样提到为抖音小程序 chooseVideo 提供 Promise 支持,但在类型声明中 chooseVideo@supported 注释仍然是 weapp, h5, rn,没有包含 tt。建议补充 tt 平台支持。

--- a/packages/taro/types/api/media/video.d.ts
+++ b/packages/taro/types/api/media/video.d.ts
@@ namespace TaroStatic {
     /** 拍摄视频或从手机相册中选视频。
-     * @supported weapp, h5, rn
+     * @supported weapp, h5, rn, tt
      * @example
      * ```tsx
      * Taro.chooseVideo({
      *   sourceType: ['album','camera'],
      *   maxDuration: 60,

🏁 Script executed:

#!/bin/bash
rg -n -C3 "chooseVideo" packages/taro/types/api/media/video.d.ts

Length of output: 997


同步更新 chooseVideo 的平台支持注释,添加 tt

以下位置需补充 tt 平台支持:

• packages/taro/types/api/media/video.d.ts
– 行 491: 将

-     * @supported weapp, h5, rn
+     * @supported weapp, h5, rn, tt

Likely an incorrect or invalid review comment.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Single-Dancer Single-Dancer added this to the 4.0.13 milestone Apr 30, 2025
@Single-Dancer
Copy link
Collaborator

@fuxichen 同学 需要更新一下对应的快照

@Single-Dancer Single-Dancer removed this from the 4.0.13 milestone May 7, 2025
This was referenced May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants