Update browser gem
`modern?` method was removed in version 4
This commit is contained in:
parent
6d703c0bd0
commit
ae2cfdd44e
6 changed files with 24 additions and 12 deletions
|
@ -118,7 +118,7 @@ GEM
|
|||
bootstrap-wysihtml5-rails (0.3.3.8)
|
||||
railties (>= 3.0)
|
||||
brakeman (4.3.1)
|
||||
browser (2.5.3)
|
||||
browser (4.0.0)
|
||||
builder (3.2.4)
|
||||
byebug (10.0.2)
|
||||
capybara (3.29.0)
|
||||
|
|
|
@ -233,7 +233,7 @@ class ApplicationController < ActionController::Base
|
|||
key: sentry[:client_key],
|
||||
enabled: sentry[:enabled],
|
||||
environment: sentry[:environment],
|
||||
browser: { modern: browser.modern? },
|
||||
browser: { modern: BrowserSupport.supported?(browser) },
|
||||
user: sentry_user
|
||||
}
|
||||
end
|
||||
|
|
|
@ -131,4 +131,12 @@ module ApplicationHelper
|
|||
def has_dismissed_outdated_browser_banner?
|
||||
cookies[:dismissed_outdated_browser_banner] == 'true'
|
||||
end
|
||||
|
||||
def supported_browser?
|
||||
BrowserSupport.supported?(browser)
|
||||
end
|
||||
|
||||
def show_outdated_browser_banner?
|
||||
!supported_browser? && !has_dismissed_outdated_browser_banner?
|
||||
end
|
||||
end
|
||||
|
|
13
app/services/browser_support.rb
Normal file
13
app/services/browser_support.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class BrowserSupport
|
||||
def self.supported?(browser)
|
||||
# See .browserslistrc
|
||||
[
|
||||
browser.chrome? && browser.version.to_i >= 50 && !browser.platform.ios?,
|
||||
browser.edge? && browser.version.to_i >= 14 && !browser.compatibility_view?,
|
||||
browser.firefox? && browser.version.to_i >= 50 && !browser.platform.ios?,
|
||||
browser.opera? && browser.version.to_i >= 40,
|
||||
browser.safari? && browser.version.to_i >= 8,
|
||||
browser.platform.ios? && browser.platform.version.to_i >= 8
|
||||
].any?
|
||||
end
|
||||
end
|
|
@ -1,5 +1,4 @@
|
|||
-# See config/browser.rb
|
||||
- if !browser.modern? && !has_dismissed_outdated_browser_banner?
|
||||
- if show_outdated_browser_banner?
|
||||
#outdated-browser-banner.site-banner
|
||||
.container
|
||||
.site-banner-icon ⚠️
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# See .browserslistrc
|
||||
Browser.modern_rules.clear
|
||||
Browser.modern_rules << -> b { b.chrome? && b.version.to_i >= 50 && !b.platform.ios? }
|
||||
Browser.modern_rules << -> b { b.edge? && b.version.to_i >= 14 && !b.compatibility_view? }
|
||||
Browser.modern_rules << -> b { b.firefox? && b.version.to_i >= 50 && !b.platform.ios? }
|
||||
Browser.modern_rules << -> b { b.opera? && b.version.to_i >= 40 }
|
||||
Browser.modern_rules << -> b { b.safari? && b.version.to_i >= 8 }
|
||||
Browser.modern_rules << -> b { b.platform.ios? && b.platform.version.to_i >= 8 }
|
Loading…
Reference in a new issue