Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bcardarella opened this issue Feb 9, 2025 · 0 comments
Open
Milestone

Comments

@bcardarella
Copy link
Collaborator

%{
  "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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant