module Turbo::Native::Navigation
def hotwire_native_app?
Hotwire Native applications are identified by having the string "Hotwire Native" as part of their user agent.
def hotwire_native_app? request.user_agent.to_s.match?(/(Turbo|Hotwire) Native/) end
def recede_or_redirect_back_or_to(url, **options)
def recede_or_redirect_back_or_to(url, **options) turbo_native_action_or_redirect url, :recede, :back, options end
def recede_or_redirect_to(url, **options)
def recede_or_redirect_to(url, **options) turbo_native_action_or_redirect url, :recede, :to, options end
def refresh_or_redirect_back_or_to(url, **options)
def refresh_or_redirect_back_or_to(url, **options) turbo_native_action_or_redirect url, :refresh, :back, options end
def refresh_or_redirect_to(url, **options)
def refresh_or_redirect_to(url, **options) turbo_native_action_or_redirect url, :refresh, :to, options end
def resume_or_redirect_back_or_to(url, **options)
def resume_or_redirect_back_or_to(url, **options) turbo_native_action_or_redirect url, :resume, :back, options end
def resume_or_redirect_to(url, **options)
def resume_or_redirect_to(url, **options) turbo_native_action_or_redirect url, :resume, :to, options end
def turbo_native_action_or_redirect(url, action, redirect_type, options = {})
def turbo_native_action_or_redirect(url, action, redirect_type, options = {}) native_params = options.delete(:native_params) || {} if turbo_native_app? redirect_to send("turbo_#{action}_historical_location_url", notice: options[:notice], **native_params) elsif redirect_type == :back redirect_back fallback_location: url, **options else redirect_to url, options end end