66039c92f3
Turbo's offline/service worker sets an x_user_agent cookie with the original browser user agent. This ensures platform detection works correctly for Hotwire Native apps where service worker requests may not carry the overridden user agent header.
13 lines
239 B
Ruby
13 lines
239 B
Ruby
module SetPlatform
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
helper_method :platform
|
|
end
|
|
|
|
private
|
|
def platform
|
|
@platform ||= ApplicationPlatform.new(cookies[:x_user_agent].presence || request.user_agent)
|
|
end
|
|
end
|