Dala.Platform.Linking (dala v0.0.9)

Copy Markdown View Source

Linking API for opening URLs and handling deep links.

Examples

# Open an external URL
socket = Dala.Linking.open_url(socket, "https://example.com")

# Check if a URL can be opened
Dala.Linking.can_open?("https://example.com") #=> true | false

# Get the initial URL that launched the app
Dala.Linking.initial_url() #=> nil | "https://..."

Incoming deep link messages are delivered to screens via handle_info/2:

def handle_info({:linking, :url, url}, socket) do
  # Process deep link URL
  {:noreply, socket}
end

Summary

Functions

can_open?(url)

@spec can_open?(String.t()) :: boolean()

initial_url()

@spec initial_url() :: String.t() | nil

open_url(socket, url)

@spec open_url(Dala.Ui.Socket.t(), String.t()) :: Dala.Ui.Socket.t()