Design flow for enabling push and the various status that go with it
This commit is contained in:
@@ -15,6 +15,14 @@ class ApplicationPlatform < PlatformAgent
|
||||
user_agent.browser.match? /Chrome/
|
||||
end
|
||||
|
||||
def edge?
|
||||
user_agent.browser.match? /Edg/
|
||||
end
|
||||
|
||||
def firefox?
|
||||
user_agent.browser.match? /Firefox|FxiOS/
|
||||
end
|
||||
|
||||
def safari?
|
||||
user_agent.browser.match? /Safari/
|
||||
end
|
||||
@@ -26,4 +34,21 @@ class ApplicationPlatform < PlatformAgent
|
||||
def desktop?
|
||||
!mobile?
|
||||
end
|
||||
|
||||
def windows?
|
||||
operating_system == "Windows"
|
||||
end
|
||||
|
||||
def operating_system
|
||||
case user_agent.platform
|
||||
when /Android/ then "Android"
|
||||
when /iPad/ then "iPad"
|
||||
when /iPhone/ then "iPhone"
|
||||
when /Macintosh/ then "macOS"
|
||||
when /Windows/ then "Windows"
|
||||
when /CrOS/ then "ChromeOS"
|
||||
else
|
||||
os =~ /Linux/ ? "Linux" : os
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user