通过实时活动打造无缝旅程
Illustration by Alexander Savard
插图作者:Alexander Savard
Building on our previous journey through design with, “That little island changes everything,” we now invite you to a technical rendezvous. If you haven’t explored the design aspects, we recommend a quick detour to understand the visual symphony that laid the groundwork. In this edition, we transition from pixels to code, exploring the technical side that orchestrates Live Activities at Lyft.
在我们之前的设计之旅中,“那个小岛改变了一切”,我们现在邀请您参加一次技术约会。如果您还没有探索设计方面的内容,我们建议您快速了解为此奠定基础的视觉交响乐。在这一期中,我们从像素转向代码,探索在Lyft上编排实时活动的技术方面。
Our primary focus will be on the client-side aspects, with a brief overview of the server functionalities. To maintain brevity, we’ll refrain from providing an exhaustive description of the inner workings. It’s worth mentioning that we won’t delve into the basics, such as widget extension setup or presentation styles and methods, as these can be readily found in the Apple Documentation. Our aim here is to offer insight into three main areas: how we manage lifecycle events, create adaptable UI elements, and seamlessly integrate remote image support.
我们的主要关注点将放在客户端方面,简要概述服务器功能。为了简洁起见,我们将不提供详尽的内部工作原理描述。值得一提的是,我们不会深入讨论基础知识,比如小部件扩展设置或演示样式和方法,因为这些可以在Apple文档中轻松找到。我们的目标是提供关于三个主要领域的见解:如何管理生命周期事件,创建适应性UI元素以及无缝集成远程图像支持。
Lifecycle
生命周期
Our activities’ lifecycle is server-driven, which provides more flexibility than a client-driven approach. There are a few key benefits: it allows updating behavior for all app versions at once, we can roll out even more specific experiences over time depending on the ride state and offer, and we avoid struggling with the long tail of different behavior in old versions. To support remote updates, it’s essential to send the server tokens, live activities’ start / end conditions, and content to be shown.
我们的活动生命周期是由服务器驱动的,这比客户端驱动的方法更灵活。有几个关键的好处:它允许一次更新所有应用版本的行为,我们可以随着时间的推移提供更具体的体验,取决于乘车状态和优惠,并且我们避免了在旧版本中不同行为的长尾问题。为了支持远程更新,发送服务器令牌、活动的开始/结束条件和要显示的内容是必不可少的。
With that in mind, we created endpoints for publishing, updating, and invalidating tok...