跳至內容

通用範本

一個彈性的進度導向範本,適用於建置、下載、部署及任何長時間執行的工作。

即時動態示範

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
將在 app 版本 1.3.3 中推出
將在 app 版本 1.7.0 中推出
將在 app 版本 1.14.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

將在 app 版本 1.3.3 中推出

本節介紹的功能來自一個正在等待 App Store 審核的 app 更新。更新上線後,此處會自動解鎖。

將在 app 版本 1.7.0 中推出

本節介紹的功能來自一個正在等待 App Store 審核的 app 更新。更新上線後,此處會自動解鎖。