Skip to content

v10.59.0

Choose a tag to compare

@sunnylqm sunnylqm released this 28 Sep 11:21
7241ffa

English

Native host APIs

  • Native host code configures Pushy with configure and prepares the next-launch bundle with prepareBundle:
    • Android: PushyRuntime.configure(Context, JSONObject, ConfigurationCallback) and PushyRuntime.prepareBundle(Context, Callback), which reports a BundlePreparationResult.
    • iOS: +[RCTPushy configure:completion:] and +[RCTPushy prepareBundleWithCompletion:], available to Swift as configure(_:completion:) and prepareBundle(completion:). The completion types are RCTPushyConfigurationCompletion and RCTPushyBundlePreparationCompletion.
    • HarmonyOS: PushyFileJSBundleProvider.configure(options: PushyConfiguration) and prepareBundle(): Promise<BundlePreparationResult>.
  • Call configure before the normal launch bundle resolution and prepareBundle after it. prepareBundle never resolves the bundle again, reloads React Native or shows UI; a selected bundle is used from the next launch.
  • Native hosts that call these APIs must update their call sites and rebuild the native app. The JavaScript SDK, the JS bridge, server paths, configuration values, result fields and persisted state are unchanged, so apps that do not call the native host APIs only need a normal upgrade.

See Native Configuration and Updates for full examples.

Full changelog

中文

原生宿主接口

  • 原生宿主通过 configure 配置 Pushy,通过 prepareBundle 准备下次启动使用的 bundle:
    • Android:PushyRuntime.configure(Context, JSONObject, ConfigurationCallback) 和 PushyRuntime.prepareBundle(Context, Callback),结果类型为 BundlePreparationResult。
    • iOS:+[RCTPushy configure:completion:] 和 +[RCTPushy prepareBundleWithCompletion:],Swift 对应 configure(_:completion:) 和 prepareBundle(completion:);回调类型为 RCTPushyConfigurationCompletion 和 RCTPushyBundlePreparationCompletion。
    • HarmonyOS:PushyFileJSBundleProvider.configure(options: PushyConfiguration) 和 prepareBundle(): Promise<BundlePreparationResult>。
  • 在正常解析启动 bundle 之前调用 configure,解析之后调用 prepareBundle。prepareBundle 不会再次解析 bundle、不会重载 React Native,也不会弹窗;选定的 bundle 从下次启动开始使用。
  • 调用了这些原生接口的宿主需要同步修改调用代码并重新构建原生应用。JS SDK、JS 桥接、服务端路径、配置值、结果字段和持久化状态均不变,未调用原生宿主接口的应用正常升级即可。

完整示例见原生配置与更新。

完整变更记录