Skip to content

when values in the interface object change push new event to server #1523

@bcardarella

Description

@bcardarella
%{
  "app_build" => "1.0",
  "app_version" => [1, 0],
  "bundle_id" => "com.example.Debuggertest",
  "i18n" => %{"time_zone" => "America/New_York"},
  "l10n" => %{"locale" => "en_US"},
  "os" => "iOS",
  "os_version" => [18, 2],
  "target" => "ios"
}

So if the i18n and i10n value changes a new event is pushed to the server "lvn:update_interface" with the following params:

%{
  "i18n" => %{"time_zone" => "Europe/Paris"}
  "i10n" => %{"locale" => "fr_FR"}
}

this would then be handled by a provided event handler built into LVN:

def handle_event("lvn:update_interface", interface_updates, socket) do
  {:noreply, assign(socket, %{"_interface" => Map.merge(socket.assigns._interface, interface_updates))}
end

the motivation is for template updates for certain values:

<Text :interface-i18n="America/New_York">New York!</Text>

In this example the SwiftUI server-side client is normalizing the %{"time_zone" => "Ameirca/New_York"} to just the "America/New_York" value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions