From 5b7aa67bb3acf40d42efeff35b69e7a5b616e881 Mon Sep 17 00:00:00 2001 From: Adrien Maston Date: Wed, 17 Dec 2025 08:56:08 +0100 Subject: [PATCH] Add platform attribute --- app/models/application_platform.rb | 16 ++++++++++++++++ app/views/layouts/application.html.erb | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/models/application_platform.rb b/app/models/application_platform.rb index 500f4adc6..9b2695cd5 100644 --- a/app/models/application_platform.rb +++ b/app/models/application_platform.rb @@ -35,10 +35,26 @@ class ApplicationPlatform < PlatformAgent !mobile? end + def native? + match? /Hotwire Native/ + end + def windows? operating_system == "Windows" end + def type + if native? && android? + "native android" + elsif native? && ios? + "native ios" + elsif mobile? + "mobile web" + else + "desktop web" + end + end + def operating_system case user_agent.platform when /Android/ then "Android" diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6aef1f1bc..79b679637 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,7 +2,7 @@ <%= render "layouts/shared/head" %> - +