From b93117defa49500d522fbac111d6490f688f4000 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 16 Dec 2014 13:04:39 -0300 Subject: [PATCH] restrict aosp usage --- js/routes.js | 35 ++++++++++++++++++++++++----------- views/unsupported.html | 12 ++++-------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/js/routes.js b/js/routes.js index 9708f0276..c52a05ba5 100644 --- a/js/routes.js +++ b/js/routes.js @@ -3,6 +3,20 @@ var LS = require('../js/plugins/LocalStorage'); var ls = new LS(); +var unsupported = false; + +if (!ls || ls.length < 1) + unsupported = true; + + +if (window && window.navigator) { + var rxaosp = window.navigator.userAgent.match(/Android.*AppleWebKit\/([\d.]+)/); + var isaosp = (rxaosp && rxaosp[1] < 537); + if (isaosp) + unsupported = true; +} + + //Setting up route angular .module('copayApp') @@ -127,18 +141,17 @@ angular } $rootScope.$on('$routeChangeStart', function(event, next, current) { - - if (!ls || ls.length < 1) { + if (unsupported) { $location.path('unsupported'); - } else { - if (!$rootScope.iden && next.logged) { - $idle.unwatch(); - $location.path('/'); - } - if ($rootScope.wallet && !$rootScope.wallet.isComplete() - && next.walletShouldBeComplete) { - $location.path('/copayers'); - } + return; + } + + if (!$rootScope.iden && next.logged) { + $idle.unwatch(); + $location.path('/'); + } + if ($rootScope.wallet && !$rootScope.wallet.isComplete() && next.walletShouldBeComplete) { + $location.path('/copayers'); } }); }) diff --git a/views/unsupported.html b/views/unsupported.html index d92e41a68..a10843926 100644 --- a/views/unsupported.html +++ b/views/unsupported.html @@ -5,14 +5,10 @@

Browser unsupported

- Copay uses WebStorage to save wallet data, - but your browser does not support it. - Please use - a current version of Internet Explorer, Safari, Google Chrome, Mozilla Firefox, or Opera. -

- - Check if your browser support WebStorage here + Copay does not support your browser. + Please use a current version of Google Chrome, Mozilla Firefox, Internet Explorer, Safari, or Opera. +
+ Note that localStorage should also be enabled (enabled by default in most cases).