Unified · Split
| @@ -245,6 +245,9 @@ · 244 unmodified lines | |||
| 245 | isMobile: -> | 245 | isMobile: -> |
| 246 | @_isMobile ?= app.views.Mobile.detect() | 246 | @_isMobile ?= app.views.Mobile.detect() |
| 247 | 247 | ||
| 248 | isAndroidWebview: -> | ||
| 249 | @_isAndroidWebview ?= app.views.Mobile.detectAndroidWebview() | ||
| 250 | |||
| 248 | isInvalidLocation: -> | 251 | isInvalidLocation: -> |
| 249 | @config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0 | 252 | @config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0 |
| 250 | 253 | ||
| @@ -73,3 +73,12 @@ app.templates.mobileIntro = """ · 72 unmodified lines | |||
| 73 | <a class="_intro-hide" data-hide-intro>Stop showing this message</a> | 73 | <a class="_intro-hide" data-hide-intro>Stop showing this message</a> |
| 74 | </div> | 74 | </div> |
| 75 | """ | 75 | """ |
| 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 | """ | ||
| @@ -10,7 +10,10 @@ class app.views.RootPage extends app.View · 9 unmodified lines | |||
| 10 | render: -> | 10 | render: -> |
| 11 | @empty() | 11 | @empty() |
| 12 | @append @tmpl('mobileNav') if app.isMobile() | 12 | @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' | ||
| 14 | return | 17 | return |
| 15 | 18 | ||
| 16 | hideIntro: -> | 19 | hideIntro: -> |
| @@ -21,6 +21,12 @@ class app.views.Mobile extends app.View · 20 unmodified lines | |||
| 21 | catch | 21 | catch |
| 22 | false | 22 | false |
| 23 | 23 | ||
| 24 | @detectAndroidWebview: -> | ||
| 25 | try | ||
| 26 | /(Android).*( Version\/.\.. ).*(Chrome)/.test(navigator.userAgent) | ||
| 27 | catch | ||
| 28 | false | ||
| 29 | |||
| 24 | constructor: -> | 30 | constructor: -> |
| 25 | @el = document.documentElement | 31 | @el = document.documentElement |
| 26 | super | 32 | super |