History

Warn Android WebView users about bugs + unofficial app

Thibaut Courouble committed 10 years ago

Commit c2ff01d1 parent 2813cf94 files · +22 −1Browse files

Unified · Split

4 files
  1. assets/javascripts/app/app.coffee +3 −0
  2. assets/javascripts/templates/pages/root_tmpl.coffee.erb +9 −0
  3. assets/javascripts/views/content/root_page.coffee +4 −1
  4. assets/javascripts/views/layout/mobile.coffee +6 −0
assets/javascripts/app/app.coffee+3−0
@@ -245,6 +245,9 @@ · 244 unmodified lines
245245 isMobile: ->
246246 @_isMobile ?= app.views.Mobile.detect()
247247
248+ isAndroidWebview: ->
249+ @_isAndroidWebview ?= app.views.Mobile.detectAndroidWebview()
250+
248251 isInvalidLocation: ->
249252 @config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0
250253
assets/javascripts/templates/pages/root_tmpl.coffee.erb+9−0
@@ -73,3 +73,12 @@ app.templates.mobileIntro = """ · 72 unmodified lines
7373 <a class="_intro-hide" data-hide-intro>Stop showing this message</a>
7474 </div>
7575 """
76+
77+app.templates.androidWarning = """
78+ <div class="_mobile-intro">
79+ <h2 class="_intro-title">Hi there</h2>
80+ <p>DevDocs is running inside an Android WebView. Some features may not work properly.
81+ <p>If you downloaded an app called DevDocs on the Play Store, please uninstall it — it's made by someone who is using (and profiting from) the name DevDocs without permission.
82+ <p>To install DevDocs on your phone, visit <a href="http://devdocs.io" target="_blank">devdocs.io</a> in Chrome and select "Add to home screen" in the menu.
83+ </div>
84+"""
assets/javascripts/views/content/root_page.coffee+4−1
@@ -10,7 +10,10 @@ class app.views.RootPage extends app.View · 9 unmodified lines
1010 render: ->
1111 @empty()
1212 @append @tmpl('mobileNav') if app.isMobile()
13− @append @tmpl if @isHidden() then 'splash' else if app.isMobile() then 'mobileIntro' else 'intro'
13+ if app.isAndroidWebview()
14+ @append @tmpl('androidWarning')
15+ else
16+ @append @tmpl if @isHidden() then 'splash' else if app.isMobile() then 'mobileIntro' else 'intro'
1417 return
1518
1619 hideIntro: ->
assets/javascripts/views/layout/mobile.coffee+6−0
@@ -21,6 +21,12 @@ class app.views.Mobile extends app.View · 20 unmodified lines
2121 catch
2222 false
2323
24+ @detectAndroidWebview: ->
25+ try
26+ /(Android).*( Version\/.\.. ).*(Chrome)/.test(navigator.userAgent)
27+ catch
28+ false
29+
2430 constructor: ->
2531 @el = document.documentElement
2632 super