sdks_如何并行支持多个expo sdks的空中更新

本文介绍了一种方法,可以在不同的Expo SDK版本中同时支持无线(OTA)更新。这种方法确保了即使用户没有立即更新他们的应用程序,也可以接收到关键的安全和稳定性补丁。文章详细介绍了如何维护多个SDK版本的分支,以及如何进行本地开发和部署。
摘要由CSDN通过智能技术生成

sdks

Expo is fantastic! It helps you develop, build, and deploy iOS, Android, and web apps. From the same codebase.

世博会很棒! 它可以帮助您开发,构建和部署iOS,Android和Web应用程序。 来自相同的代码库。

It builds the binaries for both Android & iOS on its servers, provides support for the release channels, and the over-the-air updates.

它在其服务器上为Android和iOS构建二进制文件,为发布渠道和无线更新提供支持。

OTA(无线)更新 (OTA (over-the-air) Updates)

The OTA works for any published changes to the JS bundle. You add the new feature to the app, run expo build & publish. And that’s it. Users get the update right away on their devices. In the background. Without updating the native app. Looks great so far!

OTA适用于JS捆绑包的所有已发布更改。 您将新功能添加到应用程序,运行expo build&publish。 就是这样。 用户可以立即在其设备上获取更新。 在后台。 无需更新本机应用程序。 到目前为止看起来不错!

升级Expo SDK (Upgrading Expo SDK)

When you decide to upgrade the Expo SDK, there is one thing you must remember.

当您决定升级Expo SDK时,必须记住一件事。

The SDK upgrade requires the native app to be updated on the application store (App Store, Google Play).

SDK升级要求在应用程序商店(App Store,Google Play)上更新本机应用程序。

To get the new bundle via OTA update, the SDK on the installed app must match the published one. But, there is no guarantee that all users install the updates immediately. And that is the thing.

要通过OTA更新获取新的捆绑软件,已安装应用程序上的SDK必须与已发布的应用程序匹配。 但是,不能保证所有用户都立即安装更新。 就是这样。

This is the flowchart that describes how the Expo determine which release to return to a user:

这是描述Expo如何确定返回给用户的版本的流程图:

Image for post
source: https://docs.expo.io/workflow/publishing/
来源: https : //docs.expo.io/workflow/publishing/

You can find more details about the publishing process here.

您可以在此处找到有关发布过程的更多详细信息。

The case is that the native app built with the older SDK will not receive any OTA updates for any subsequent SDK release until the user updates the native app.

情况是,使用旧版SDK构建的本机应用程序在用户更新本机应用程序之前,将不会收到任何后续SDK版本的任何OTA更新。

Yeah, I understand, you might communicate that the user should update the app. Deploy a subtle “Please update the app” banner to the old version and forget about the thing.

是的,我了解,您可能会传达用户应该更新应用程序的信息。 将微妙的“请更新应用程序”标语部署到旧版本,然后将其遗忘。

Fair enough. This is okay for most cases.

很公平。 在大多数情况下都可以。

Deep down, you may realize that you want to be able to release any security and the stability patches for the old versions as well. It may also be some urgent feature that displays the CTA button for the new service you added, let say, because of the pandemic.

从头开始,您可能会意识到,您还希望能够发布旧版本的所有安全性和稳定性补丁。 也许由于流行病,某些紧急功能会显示您添加的新服务的CTA按钮。

该方法 (The Approach)

You can just assume that you will only support the latest version.

您可以假设您仅支持最新版本。

I’d suggest you check the application statistics. Specify the percentage threshold of the users you want to cover with the updates. Based on that, define the exact SDK versions you have to support.

我建议您检查应用程序统计信息。 指定要覆盖更新的用户的百分比阈值。 基于此,定义您必须支持的确切SDK版本。

资料库 (Repository)

Create a branch from the main, right before the SDK upgrade. If it’s too late, use the last commit before the upgrade.

在SDK升级之前,从main创建一个分支。 如果为时已晚,请在升级之前使用最后一次提交。

For example, $ git switch main; git switch -c main-expo-sdk-36.

例如, $ git switch main; git switch -c main-expo-sdk-36 $ git switch main; git switch -c main-expo-sdk-36

Merge any feature branch to the main as usual. Additionally, apply the feature to the other SDK branch as well. Assume you want to merge the CTA button feature from the feature/cta-button branch.

像往常一样将任何功能分支合并到main分支。 此外,也将该功能应用于其他SDK分支。 假设您要合并来自feature/cta-button分支的CTA按钮功能。

(main) $ git merge feature/cta-button
(main) $ git push
(main) $ git switch main-expo-sdk36
(main-expo-sdk-36) $ git merge feature/cta-button
(main-expo-sdk-36) $ git push

部署方式 (Deployment)

The process remains unchanged, except that you have to do the same also for every main-expo-sdk-* branch. It can be deployed to the same release channel (see the diagram above).

该过程保持不变,只不过您必须对每个main-expo-sdk-*分支都执行相同的操作。 可以将其部署到相同的发布渠道(请参见上图)。

当地发展 (Local development)

Using the same source folder is time-consuming.

使用相同的源文件夹非常耗时。

You have to re-install node modules when switching between the SDK versions. This can be a pain if you want to perform several updates.

在两个SDK版本之间切换时,您必须重新安装节点模块。 如果要执行多个更新,可能会很痛苦。

The solution is to create multiple project instances. One for each version of the SDK you will support. It’s Explained in the next section.

解决方案是创建多个项目实例。 您将支持的每种版本的SDK。 下一节将对此进行解释。

Clone the repo to a different folder(s) and work on the main-expo-sdk-* branches there. Assume you have a my-app app, and you want to support SDK 36.

将存储库克隆到其他文件夹,然后在其中的main-expo-sdk-*分支上工作。 假设您有一个my-app程序,并且想要支持SDK 36。

# clone the same repository to my-app-sdk-36
$ git clone git@server:my-app.git ~/repos/my-app-sdk-36;# it should be a new folder here
$ ls ~/repos;
my-app
my-app-expo-sdk-36# enter the new folder and switch the branch to the SDK
$ cd my-app-expo-36;
$ git switch main-expo-sdk-36;

概要 (Summary)

概要(Summary)

This the solution to reach most of the users with urgent updates.

该解决方案可以通过紧急更新覆盖大多数用户。

When you upgrade the Expo SDK, it does not mean every device got the update right away. The subsequent OTA updates will not work for the devices with older SDKs.

升级Expo SDK时,并不意味着每个设备都会立即获得更新。 随后的OTA更新将不适用于带有较旧SDK的设备。

It is okay for most cases, but you are prepared for the other scenarios as well.

在大多数情况下都可以,但是您也为其他情况做好了准备。

翻译自: https://medium.com/@abuduba/how-to-support-over-the-air-updates-on-multiple-expo-sdks-in-parallel-3bd65c62d230

sdks

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值