跳至内容

通用模板

一个灵活的基于进度的模板,适用于构建、下载、部署以及任何长时间运行的任务。

实时活动演示

Fields

FieldTypeDescription
templatestringRequired. Must be "generic"
progressfloatRequired. Value between 0.0 and 1.0; shown as a percentage in the top-right corner
statestringShort status text (e.g. "Building...", "Complete")
iconstringSF Symbol name (e.g. "arrow.triangle.branch", "washer") or MDI icon with mdi: prefix (e.g. "mdi:washing-machine", "mdi:thermometer")
remaining_timeintegerRemaining time in seconds, shown as a countdown alongside the progress bar
subtitlestringSecondary text below the progress bar
accent_colorstringNamed color or hex (e.g. "cyan", "#00BCD4")
background_colorstringBackground color override
text_colorstringText color override
将在应用版本 1.3.3 中推出
将在应用版本 1.7.0 中推出

Renders url_action and secondary_url_action as buttons beneath the progress bar, and treats taps on the rest of the card as tap_action -- see Tap actions.

Example Payload

启动一个通用 activity
{
  "state": "ongoing",
  "content": {
    "template": "generic",
    "progress": 0.65,
    "state": "Washing",
    "icon": "washer",
    "remaining_time": 1800,
    "subtitle": "Cycle 2 of 3",
    "accent_color": "blue"
  }
}

Live progress

将在应用版本 1.3.3 中推出

本节介绍的功能来自一个正在等待 App Store 审核的应用更新。更新上线后,此处会自动解锁。

将在应用版本 1.7.0 中推出

本节介绍的功能来自一个正在等待 App Store 审核的应用更新。更新上线后,此处会自动解锁。