diff --git a/assets/javascripts/app/app.coffee b/assets/javascripts/app/app.coffee index 85c5ec5f..ddb1559a 100644 --- a/assets/javascripts/app/app.coffee +++ b/assets/javascripts/app/app.coffee @@ -245,6 +245,9 @@ isMobile: -> @_isMobile ?= app.views.Mobile.detect() + isAndroidWebview: -> + @_isAndroidWebview ?= app.views.Mobile.detectAndroidWebview() + isInvalidLocation: -> @config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0 diff --git a/assets/javascripts/templates/pages/root_tmpl.coffee.erb b/assets/javascripts/templates/pages/root_tmpl.coffee.erb index 514f217e..87068f67 100644 --- a/assets/javascripts/templates/pages/root_tmpl.coffee.erb +++ b/assets/javascripts/templates/pages/root_tmpl.coffee.erb @@ -73,3 +73,12 @@ app.templates.mobileIntro = """ Stop showing this message """ + +app.templates.androidWarning = """ +
+

Hi there

+

DevDocs is running inside an Android WebView. Some features may not work properly. +

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. +

To install DevDocs on your phone, visit devdocs.io in Chrome and select "Add to home screen" in the menu. +

+""" diff --git a/assets/javascripts/views/content/root_page.coffee b/assets/javascripts/views/content/root_page.coffee index 3ef18f7b..fcb2da43 100644 --- a/assets/javascripts/views/content/root_page.coffee +++ b/assets/javascripts/views/content/root_page.coffee @@ -10,7 +10,10 @@ class app.views.RootPage extends app.View render: -> @empty() @append @tmpl('mobileNav') if app.isMobile() - @append @tmpl if @isHidden() then 'splash' else if app.isMobile() then 'mobileIntro' else 'intro' + if app.isAndroidWebview() + @append @tmpl('androidWarning') + else + @append @tmpl if @isHidden() then 'splash' else if app.isMobile() then 'mobileIntro' else 'intro' return hideIntro: -> diff --git a/assets/javascripts/views/layout/mobile.coffee b/assets/javascripts/views/layout/mobile.coffee index e77d9a89..aec6692f 100644 --- a/assets/javascripts/views/layout/mobile.coffee +++ b/assets/javascripts/views/layout/mobile.coffee @@ -21,6 +21,12 @@ class app.views.Mobile extends app.View catch false + @detectAndroidWebview: -> + try + /(Android).*( Version\/.\.. ).*(Chrome)/.test(navigator.userAgent) + catch + false + constructor: -> @el = document.documentElement super