已合并
docs: update README document for 0.72 branch of react-native-restart library #27
docs: update README document for 0.72 branch of react-native-restart library #27
已合并
fanwangah创建于 8月4日
fanwangah
8月4日

docs: update README document for 0.72 branch of react-native-restart library

likedislike
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 fanwangah 的贡献)
Ffanwangah
8月4日 关联了issue:fix: 修改react-native-restart三方库72分支AI文档质量扫描整改
openharmony_ci
openharmony_ci成员
8月4日 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
openharmony_ciopenharmony_ci成员
8月4日 添加了label:dco检查成功
wupingyuan
wupingyuan
8月4日 评论:

已审视,无问题

likedislike
cpf-manager
cpf-manager8月4日进行代码检视3
README.md
已过期
@@ -218,0 +235,4 @@
235+ <Text
236+ style={styles.button}
237+ onPress={async () => {
238+ const reason = await RNRestart.getReason();
cpf-manager
cpf-manager8月4日评论:

【AI-Review】【一般】【基础代码问题】【异常处理】getReason 示例未处理 Promise 拒绝场景

● 问题: 示例代码 const reason = await RNRestart.getReason(); 未使用 try-catch 包裹。根据 harmony/restart/src/main/ets/RNRestartTurboModule.ts 第 79-88 行的实现,getReason()restartReason 为空字符串时(即未执行过 restart/Restart)会执行 reject('reason is empty');而 restartReason 静态字段初始值为 ''(第 37 行)。当用户在未先点击 restart 或 Restart 的情况下直接点击 getReason 按钮时,await 将抛出异常,由于 onPress 是 async 回调且无 try-catch,会产生 unhandled promise rejection。

● 影响: 一般。用户按示例代码使用时,若在未执行 restart 的情况下点击 getReason,会触发未捕获的 Promise 拒绝,导致测试框架报告异常或控制台告警,影响示例可用性。

● 建议: 使用 try-catch 包裹 await 调用,处理拒绝场景:

onPress={async () => {
  try {
    const reason = await RNRestart.getReason();
    setRestartReason(reason);
    setState(reason);
  } catch (e) {
    setRestartReason("");
    setState("");
  }
}}
likedislike
System
系统消息系统
8月4日 评论:

changed this line on 1cc4b065 view diff detail

fanwangah
8月4日 评论:

已修改

cpf-manager
cpf-manager8月4日进行代码检视2
README_en.md
@@ -219,0 +235,4 @@
235+ return (
236+ <Text
237+ style={styles.button}
238+ onPress={async () => {
cpf-manager
cpf-manager8月4日评论:

【AI-Review】【一般】【基础代码问题】【异常处理】getReason 示例未处理 Promise 拒绝场景

● 问题: 示例代码 const reason = await RNRestart.getReason(); 未使用 try-catch 包裹。根据 harmony/restart/src/main/ets/RNRestartTurboModule.ts 第 79-88 行的实现,getReason()restartReason 为空字符串时(即未执行过 restart/Restart)会执行 reject('reason is empty');而 restartReason 静态字段初始值为 ''(第 37 行)。当用户在未先点击 restart 或 Restart 的情况下直接点击 getReason 按钮时,await 将抛出异常,由于 onPress 是 async 回调且无 try-catch,会产生 unhandled promise rejection。

● 影响: 一般。用户按示例代码使用时,若在未执行 restart 的情况下点击 getReason,会触发未捕获的 Promise 拒绝,导致测试框架报告异常或控制台告警,影响示例可用性。

● 建议: 使用 try-catch 包裹 await 调用,处理拒绝场景:

onPress={async () => {
  try {
    const reason = await RNRestart.getReason();
    setRestartReason(reason);
    setState(reason);
  } catch (e) {
    setRestartReason("");
    setState("");
  }
}}
likedislike
fanwangah
8月4日 评论:

已修改

cpf-manager
cpf-manager8月4日进行代码检视2
README_en.md
@@ -220,0 +240,4 @@
240+ setRestartReason(reason);
241+ setState(reason);
242+ }}
243+ >
cpf-manager
cpf-manager8月4日评论:

【AI-Review】【一般】【基础代码问题】【代码逻辑错误】英文 README 示例代码中包含中文文本

● 问题: README_en.md 第 243 行示例代码 getReason{restartReason ? (原因:${restartReason}) : ""} 使用了中文全角括号 和中文文本 原因:。该文件为英文文档(README_en.md),同一段代码在中文 README.md 中使用中文文本是正确的,但在英文文档中应使用英文文本以保持本地化一致性。

● 影响: 一般。英文文档的使用者在代码示例中看到中文文本,影响文档的本地化一致性和可读性,且复制后会在英文环境的应用界面中显示中文。

● 建议: 将中文文本改为英文:

getReason{restartReason ? ` (reason: ${restartReason})` : ""}
likedislike
fanwangah
8月4日 评论:

已修改

yangweiping
yangweiping8月4日进行代码检视3
README_en.md
已过期
@@ -9,3 +9,3 @@
99| Name | Version | Release Information | Supported RN Version | Supported Autolink | Compile API Version | Community Baseline Version | npm Address |
1010| - | - | - | - | - | - | - | - |
11-| @react-native-ohos/react-native-restart | ~0.0.28 | [Gitcode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-restart/releases) | 0.72.* | Yes | API12+ | 0.0.27 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-restart) |
11+| @react-native-ohos/react-native-restart | ~0.0.28 | [Gitcode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-restart/releases) | 0.72.* | Yes | API12+ | 0.0.27 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-restart) |
yangweiping
yangweiping8月4日评论:

模板做了一些变更,后续的文档需要按照新的去更改

变更点:

  1. 版本号由0.4.1更新为0.4.2
  2. 顶部所属关系映射表,三方库版本修改为三方库版本(npm地址),链接修改为原先npm地址的链接,同时删除npm地址字段
  3. 增加源码地址字段,值为对应分支,并添加对应分支跳转链接

另外这些也一并修改下:
1.openahrmony-sig的链接修改为CPF-RN。
2.

不再支持居中,修改为p align="center"方式居中。
3.部分库链接到usage-docs,迁移后相对路径不存在,应该使用完整路径。
例如:对于未发布到npm的旧版本,请参考安装指南安装tgz包。链接应该修改为 https://gitcode.com/CPF-RN/usage-docs/blob/master/zh-cn/tgz-usage.md
例如:> [!TIP] 如需使用直接链接源码,请参考直接链接源码说明。链接应该修改为 https://gitcode.com/CPF-RN/usage-docs/blob/master/zh-cn/link-source-code.md

likedislike
System
系统消息系统
8月4日 评论:

changed this line on 1cc4b065 view diff detail

fanwangah
8月4日 评论:

已修改

Ffanwangah
8月4日 强制推送  1 个提交:1cc4b065-fix: 修改react-native-restart三方库72分支AI文档质量扫描整改
openharmony_ci
openharmony_ci成员
8月4日 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
Ffanwangah
8月4日 强制推送  1 个提交:109d9758-fix: 修改react-native-restart三方库72分支AI文档质量扫描整改
openharmony_ci
openharmony_ci成员
8月4日 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
fanwangah
1 天前 评论:

start build

likedislike
Ffanwangah
1 天前 修改标题为 “doc: 修改react-native-restart三方库72分支AI文档质量扫描整改”,原标题为“fix: 修改react-native-restart三方库72分支AI文档质量扫描整改”
openharmony_ci
openharmony_ci成员
1 天前 评论:

首次触发
门禁构建开始,包含静态检查,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a312e64650f998b9ccd79/runlist

likedislike
Ffanwangah
1 天前 修改标题为 “docs: update README document for 0.72 branch of react-native-restart library”,原标题为“doc: 修改react-native-restart三方库72分支AI文档质量扫描整改”
Ffanwangah
1 天前 修改了pull request 的描述
openharmony_ciopenharmony_ci成员
23 小时前 添加了label:静态检查失败
openharmony_ci
openharmony_ci成员
23 小时前 评论:

代码门禁未通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a312e64650f998b9ccd79/runlist

静态检查:

# check type result report
1 codeCheck noPass >>>

likedislike
fanwangah
23 小时前 评论:

start build

likedislike
openharmony_ciopenharmony_ci成员
23 小时前 删除了label:静态检查失败
openharmony_ci
openharmony_ci成员
23 小时前 评论:

部分构建失败,仅触发失败构建
门禁构建开始,包含静态检查,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a389a64650f998ba00078/runlist

likedislike
openharmony_ciopenharmony_ci成员
23 小时前 添加了label:静态检查失败
openharmony_ci
openharmony_ci成员
23 小时前 评论:

代码门禁未通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a389a64650f998ba00078/runlist

静态检查:

# check type result report
1 codeCheck noPass >>>

likedislike
Ffanwangah
23 小时前 强制推送  1 个提交:58993ffe-docs: update README document for 0.72 branch of react-native-restart library
openharmony_ciopenharmony_ci成员
23 小时前 删除了label:静态检查失败
openharmony_ci
openharmony_ci成员
23 小时前 评论:

代码有更新,重置PR验证状态

likedislike
fanwangah
23 小时前 评论:

start build

likedislike
openharmony_ci
openharmony_ci成员
23 小时前 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
openharmony_ci
openharmony_ci成员
23 小时前 评论:

本地或库上代码有更新,全量重新构建,重置所有关联PR的验证状态
门禁构建开始,包含静态检查,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a3ea664650f998ba276fe/runlist

likedislike
openharmony_ciopenharmony_ci成员
23 小时前 添加了label:静态检查成功
openharmony_ciopenharmony_ci成员
23 小时前 通过测试
openharmony_ci
openharmony_ci成员
23 小时前 评论:

代码门禁通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a3ea664650f998ba276fe/runlist

静态检查:

# check type result report
1 codeCheck pass >>>

likedislike
dingchengjiedingchengjie成员
20 小时前 将dingchengjie设为审查人
dingchengjiedingchengjie成员
20 小时前 通过审查
dingchengjiedingchengjie成员
20 小时前 解决了最后一个问题
openharmony_ciopenharmony_ci成员
20 小时前 关闭了关联的issue
openharmony_ciopenharmony_ci成员
20 小时前 合入了pull request,合并节点 SHA:abd775660bcf0b65ac2d2d64b4cb6a36c60f9998
openharmony_dcp
openharmony_dcp成员
20 小时前 评论:

你因提交次数过多被限制提交,为保障上库效率、避免资源浪费,请先观看学习视频:https://dcp.openharmony.cn/workbench/video/videoDisplay

likedislike