class UI::LiveActivity

Overview

Export-only ActivityKit-style state for one live activity.

The state is deliberately plain data: an attributes type, the exported attributes payload, the content-state payload, and an optional update intent.

Defined in:

ui/live_activities.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(attributes_type : String, identifier : String | Nil = nil, attributes : Hash(String, String) = {} of String => String, content_state : Hash(String, String) = {} of String => String, update_intent : LiveActivityUpdateIntent | Nil = nil, is_active : Bool = true) #

[View source]

Instance Method Detail

def add_attribute(key : String, value : String) : String #

[View source]
def add_content_state_field(key : String, value : String) : String #

[View source]
def attach_update_intent(intent : LiveActivityUpdateIntent) : LiveActivityUpdateIntent #

[View source]
def attributes : Hash(String, String) #

[View source]
def attributes=(attributes : Hash(String, String)) #

[View source]
def attributes_type : String #

[View source]
def attributes_type=(attributes_type : String) #

[View source]
def build_update_intent(identifier : String, title : String | Nil = nil, subtitle : String | Nil = nil, system_image : String | Nil = nil, user_info : Hash(String, String) = {} of String => String, is_enabled : Bool = true) : LiveActivityUpdateIntent #

[View source]
def content_state : Hash(String, String) #

[View source]
def content_state=(content_state : Hash(String, String)) #

[View source]
def identifier : String #

[View source]
def identifier=(identifier : String) #

[View source]
def is_active : Bool #

[View source]
def is_active=(is_active : Bool) #

[View source]
def to_activitykit_scaffold(indent : Int32 = 4) : String #

Export a deterministic Swift/ActivityKit scaffold for this activity.

The scaffold stays conservative: it mirrors the exported keys as typed string properties and records the update intent metadata as static constants so a later build step can fill in the real ActivityKit surface.


[View source]
def to_payload(json : JSON::Builder) : Nil #

[View source]
def update_intent : LiveActivityUpdateIntent | Nil #

[View source]
def update_intent=(update_intent : LiveActivityUpdateIntent | Nil) #

[View source]