d17134cb5c
Yes, Platform Agent is overkill for just this but there isn't a one-size JS solution for updating both input placeholders and other HTML text and we're likely to need it later for other things like displaying platform-specific PWA prompts.
30 lines
369 B
Ruby
30 lines
369 B
Ruby
class ApplicationPlatform < PlatformAgent
|
|
def ios?
|
|
match? /iPhone|iPad/
|
|
end
|
|
|
|
def android?
|
|
match? /Android/
|
|
end
|
|
|
|
def mac?
|
|
match? /Macintosh/
|
|
end
|
|
|
|
def chrome?
|
|
user_agent.browser.match? /Chrome/
|
|
end
|
|
|
|
def safari?
|
|
user_agent.browser.match? /Safari/
|
|
end
|
|
|
|
def mobile?
|
|
ios? || android?
|
|
end
|
|
|
|
def desktop?
|
|
!mobile?
|
|
end
|
|
end
|