Skip to content

v10.57.0

Latest

Choose a tag to compare

@github-actions github-actions released this 19 Sep 02:38

English

Native configuration and update APIs

  • Android, iOS and HarmonyOS now expose native-host configure and checkAndUpdate APIs (#641). Hosts can configure Pushy before JavaScript or the React Native bridge starts, then check and download through the existing native update pipeline after normal launch bundle resolution.
  • Android: PushyNativeUpdate.configure(Context, JSONObject, ConfigurationCallback) and checkAndUpdate(Context, Callback). iOS: +[RCTPushy configure:completion:] and +[RCTPushy checkAndUpdateWithCompletion:], available to Swift as configure(_:completion:) and checkAndUpdate(completion:). HarmonyOS: PushyFileJSBundleProvider.configure(...) and checkAndUpdate() with exported configuration/result types.
  • Configuration validates appKey, endpoints, discovery URLs and activation policy before replacing the existing settings. Native-first provisioning creates a stable installation identifier. Configuration changes invalidate stale response caches and pending native decisions.
  • The new nativeConfigSource: 'native' JS option prevents JavaScript initialization and setOptions from overwriting native-owned settings. The default remains 'javascript' for existing integrations; native configuration is not automatically mirrored into JS options.
  • Results distinguish skipped, noUpdate, downloaded, failed and cancelled. Concurrent native callers share one round; completed rounds are reused. Missing configuration no longer consumes the process's first real check opportunity.

Compatibility and integration

  • Rebuild and distribute the native application. A JS-only hot update cannot add these native APIs. Source-based HarmonyOS integrations must rebuild the HAR; the npm package includes the updated HAR.
  • Configuration can run before JS, but checking still requires the application's real launch bundle resolution. Do not resolve the bundle again merely to initialize checking.
  • afterDownload defaults to none; use setNeedUpdate to select an ordinary downloaded update for the next launch. activated: true means selected for the next launch, not an immediate React Native reload. Existing server forceBoot and crash-rescue rules remain in effect.
  • Each process performs at most one real native update round, including failed rounds. Reconfiguration invalidates old results but does not grant another round. Native calls do not display update dialogs or invoke JS lifecycle hooks.
  • See the native configuration and update guide for platform examples and configuration ownership.

Tests and examples

  • Added 38 native-host/configuration regression tests. Lint, JS/C++ tests, Android/iOS E2E and HarmonyOS build checks passed for the merged implementation.
  • Updated Expo and HarmonyOS examples and local E2E tooling included since v10.56.1.

Full changelog

中文

原生配置与更新接口

  • Android、iOS 和 HarmonyOS 新增供原生宿主使用的 configurecheckAndUpdate 接口(#641)。宿主可在 JavaScript 或 React Native bridge 启动前配置 Pushy,在应用正常解析启动 bundle 后,通过现有原生更新链路检查并下载更新。
  • Android:PushyNativeUpdate.configure(Context, JSONObject, ConfigurationCallback)checkAndUpdate(Context, Callback)。iOS:+[RCTPushy configure:completion:]+[RCTPushy checkAndUpdateWithCompletion:],Swift 对应 configure(_:completion:)checkAndUpdate(completion:)。HarmonyOS:PushyFileJSBundleProvider.configure(...)checkAndUpdate(),并导出配置与结果类型。
  • 替换现有配置前校验 appKey、服务端地址、发现地址和激活策略;原生首次配置会生成稳定的安装标识。配置变更会使旧响应缓存和进行中的旧原生决策失效。
  • 新增 JS 选项 nativeConfigSource: 'native',防止 JavaScript 初始化和 setOptions 覆盖原生管理的配置。默认仍为 'javascript',保持现有接入方式兼容;原生配置不会自动回填 JS 选项。
  • 返回状态区分 skippednoUpdatedownloadedfailedcancelled。并发原生调用共享同一轮任务,已完成轮次复用结果。尚无配置时跳过,不再消耗本进程首次实际检查机会。

兼容性与接入

  • 必须重新构建并分发原生安装包,不能仅通过 JS 热更新添加这些原生接口。 从源码接入 HarmonyOS 时需重新构建 HAR;npm 包已包含更新后的 HAR。
  • 配置可以在 JS 启动前完成,但检查仍需要应用正常的启动 bundle 解析。不要仅为初始化检查而再次解析 bundle。
  • afterDownload 默认为 none;使用 setNeedUpdate 可将普通下载更新选为下次启动版本。activated: true 表示已选为下次启动使用的版本,不表示立即重载 React Native。原有服务端 forceBoot 和崩溃救援规则继续生效。
  • 每进程至多执行一轮实际原生更新,包括失败轮次。重新配置会使旧结果失效,但不会增加新轮次。原生调用不展示更新弹窗,也不执行 JS 生命周期钩子。
  • 三端示例与配置所有权说明见原生配置与更新指南

测试与示例

  • 新增 38 项原生宿主与配置回归测试。合并实现已通过 lint、JS/C++ 测试、Android/iOS E2E 和 HarmonyOS 构建检查。
  • 包含 v10.56.1 以来的 Expo、HarmonyOS 示例及本地 E2E 工具更新。

完整变更记录