From 1224f89c17d402be3715f0ffe1b5ee6fa007b8ae Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Jun 2015 11:59:48 -0300 Subject: [PATCH 1/4] Copay: Terms of Use in APP --- public/views/disclaimer.html | 20 +++++++++++++ public/views/preferencesAbout.html | 45 ++++++++++++++++-------------- public/views/walletHome.html | 2 +- src/css/main.css | 3 ++ src/js/routes.js | 37 +++++++++++++++++++++--- src/js/services/profileService.js | 42 ++++++++++++++++------------ src/js/services/storageService.js | 8 ++++++ 7 files changed, 113 insertions(+), 44 deletions(-) create mode 100644 public/views/disclaimer.html diff --git a/public/views/disclaimer.html b/public/views/disclaimer.html new file mode 100644 index 000000000..8f0ce58dc --- /dev/null +++ b/public/views/disclaimer.html @@ -0,0 +1,20 @@ +
+
+ +
+

Terms of Use

+
+

+ The software you are about to use functions as a free, open source, and multi-signature digital wallet. The software does not constitute an account where BitPay or other third parties serve as financial intermediaries or custodians of your bitcoin. While the software has undergone beta testing and continues to be improved by feedback from the open-source user and developer community, we cannot guarantee that there will be no bugs in the software. You acknowledge that your use of this software is at your own discretion and in compliance with all applicable laws. You are responsible for safekeeping your passwords, private key pairs, PINs and any other codes you use to access the software. IF YOU LOSE ACCESS TO YOUR COPAY WALLET OR YOUR ENCRYPTED PRIVATE KEYS AND YOU HAVE NOT SEPARATELY STORED A BACKUP OF YOUR WALLET AND CORRESPONDING PASSWORD, YOU ACKNOWLEDGE AND AGREE THAT ANY BITCOIN YOU HAVE ASSOCIATED WITH THAT COPAY WALLET WILL BECOME INACCESSIBLE. All transaction requests are irreversible. The authors of the software, employees and affiliates of Bitpay, copyright holders, and BitPay, Inc. cannot retrieve your private keys or passwords if you lose or forget them and cannot guarantee transaction confirmation as they do not have control over the Bitcoin network. To the fullest extent permitted by law, this software is provided “as is” and no representations or warranties can be made of any kind, express or implied, including but not limited to the warranties of merchantability, fitness or a particular purpose and noninfringement. You assume any and all risks associated with the use of the software. In no event shall the authors of the software, employees and affiliates of Bitpay, copyright holders, or BitPay, Inc. be held liable for any claim, damages or other liability, whether in an action of contract, tort, or otherwise, arising from, out of or in connection with the software. We reserve the right to modify this disclaimer from time to time. +

+ + +
+
+
diff --git a/public/views/preferencesAbout.html b/public/views/preferencesAbout.html index f0b96d411..7be0a87cb 100644 --- a/public/views/preferencesAbout.html +++ b/public/views/preferencesAbout.html @@ -4,36 +4,39 @@ ng-init="titleSection='About Copay'; goBackToState = 'preferences'"> -
-
diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 9e4d47d10..13be22a95 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -9,7 +9,7 @@
You do not have a wallet
- +
diff --git a/src/css/main.css b/src/css/main.css index 88c385a06..f344b4dfd 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -157,6 +157,9 @@ input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill, inpu overflow: auto; } +.content.disclaimer { + top: 0; +} .logo-setup { text-align: center; diff --git a/src/js/routes.js b/src/js/routes.js index 288ad5585..24761c787 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -73,10 +73,14 @@ angular views: { 'main': { templateUrl: 'views/splash.html', - controller: function($scope, $timeout, $log, profileService, go) { - if (profileService.profile) { - go.walletHome(); - } + controller: function($scope, $timeout, $log, profileService, storageService, go) { + storageService.getCopayDisclaimer(function(err, val) { + if (!val) go.path('disclaimer'); + + if (profileService.profile) { + go.walletHome(); + } + }); $scope.create = function(noWallet) { $scope.creatingProfile = true; @@ -97,6 +101,27 @@ angular } } }) + $stateProvider + .state('disclaimer', { + url: '/disclaimer', + needProfile: false, + views: { + 'main': { + templateUrl: 'views/disclaimer.html', + controller: function($scope, storageService, applicationService) { + storageService.getCopayDisclaimer(function(err, val) { + $scope.agreed = val; + }); + + $scope.agree = function() { + storageService.setCopayDisclaimer(function(err) { + applicationService.restart(); + }); + }; + } + } + } + }) .state('walletHome', { url: '/', walletShouldBeComplete: true, @@ -427,6 +452,7 @@ angular preferencesEmail: 12, about: 12, logs: 13, + disclaimer: 13, add: 11, create: 12, join: 12, @@ -451,6 +477,9 @@ angular if (err.message.match('NOPROFILE')) { $log.debug('No profile... redirecting'); $state.transitionTo('splash'); + } else if (err.message.match('NONAGREEDDISCLAIMER')) { + $log.debug('Display disclaimer... redirecting'); + $state.transitionTo('disclaimer'); } else { throw new Error(err); // TODO } diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 6b8132e8e..64c84b685 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -135,26 +135,32 @@ angular.module('copayApp.services') }; root.loadAndBindProfile = function(cb) { - storageService.getProfile(function(err, profile) { - if (err) { - $rootScope.$emit('Local/DeviceError', err); - return cb(err); - } - if (!profile) { - // Migration?? - storageService.tryToMigrate(function(err, migratedProfile) { - if (err) return cb(err); - if (!migratedProfile) - return cb(new Error('NOPROFILE: No profile')); - - profile = migratedProfile; - return root.bindProfile(profile, cb); - }) + storageService.getCopayDisclaimer(function(err, val) { + if (!val) { + return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer')); } else { - $log.debug('Profile read'); - return root.bindProfile(profile, cb); - } + storageService.getProfile(function(err, profile) { + if (err) { + $rootScope.$emit('Local/DeviceError', err); + return cb(err); + } + if (!profile) { + // Migration?? + storageService.tryToMigrate(function(err, migratedProfile) { + if (err) return cb(err); + if (!migratedProfile) + return cb(new Error('NOPROFILE: No profile')); + profile = migratedProfile; + return root.bindProfile(profile, cb); + }) + } else { + $log.debug('Profile read'); + return root.bindProfile(profile, cb); + } + + }); + } }); }; diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js index 91b780ae3..479c658fa 100644 --- a/src/js/services/storageService.js +++ b/src/js/services/storageService.js @@ -176,5 +176,13 @@ angular.module('copayApp.services') storage.remove('config', cb); }; + root.setCopayDisclaimer = function(cb) { + storage.set('agreeDisclaimer', true, cb); + }; + + root.getCopayDisclaimer = function(cb) { + storage.get('agreeDisclaimer', cb); + }; + return root; }); From 9cebdbef425152c5c8a4dcabfdef33bf79ab679d Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Jun 2015 12:53:38 -0300 Subject: [PATCH 2/4] Fix reloading after restart app --- src/js/controllers/preferencesBwsUrl.js | 3 +-- src/js/routes.js | 9 +++++++-- src/js/services/applicationService.js | 8 +++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/js/controllers/preferencesBwsUrl.js b/src/js/controllers/preferencesBwsUrl.js index cf4483f70..9702e2201 100644 --- a/src/js/controllers/preferencesBwsUrl.js +++ b/src/js/controllers/preferencesBwsUrl.js @@ -21,8 +21,7 @@ angular.module('copayApp.controllers').controller('preferencesBwsUrlController', configService.set(opts, function(err) { if (err) console.log(err); $scope.$emit('Local/BWSUpdated'); - applicationService.restart(true); - go.walletHome(); + applicationService.restart(); }); }; diff --git a/src/js/routes.js b/src/js/routes.js index 24761c787..817772cd0 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -108,14 +108,19 @@ angular views: { 'main': { templateUrl: 'views/disclaimer.html', - controller: function($scope, storageService, applicationService) { + controller: function($scope, $timeout, storageService, applicationService, go) { storageService.getCopayDisclaimer(function(err, val) { $scope.agreed = val; + $timeout(function(){ + $scope.$digest(); + }, 1); }); $scope.agree = function() { storageService.setCopayDisclaimer(function(err) { - applicationService.restart(); + $timeout(function(){ + applicationService.restart(); + }, 1000); }); }; } diff --git a/src/js/services/applicationService.js b/src/js/services/applicationService.js index 1855a6d97..c920a11cc 100644 --- a/src/js/services/applicationService.js +++ b/src/js/services/applicationService.js @@ -3,18 +3,16 @@ angular.module('copayApp.services') .factory('applicationService', function($rootScope, $timeout, isCordova, isChromeApp) { var root = {}; - root.restart = function(hard) { + root.restart = function() { + var hashIndex = window.location.href.indexOf('#/'); if (isCordova) { - if (hard) { - location.reload(); - } + window.location = window.location.href.substr(0, hashIndex); $timeout(function() { $rootScope.$digest(); }, 1); } else { // Go home reloading the application - var hashIndex = window.location.href.indexOf('#/'); if (isChromeApp) { chrome.runtime.reload(); } else { From be6c132fbc7e39c76abb2ca586b6784fa7b4fe16 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Jun 2015 15:44:54 -0300 Subject: [PATCH 3/4] Fixes scrolling on modals for desktop versions --- src/css/mobile.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/css/mobile.css b/src/css/mobile.css index 39a68387d..f741d22c2 100644 --- a/src/css/mobile.css +++ b/src/css/mobile.css @@ -565,6 +565,7 @@ to prevent collapsing during animation*/ width: 100%; top: 45px; padding-bottom: 33px; + -webkit-transform: translate3d(0,0,0); } .reveal-modal { From 36b6efa9e48ab602c9e94d291abd357b390ee396 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Jun 2015 16:30:21 -0300 Subject: [PATCH 4/4] Fixes restart desktop application --- src/js/services/applicationService.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/js/services/applicationService.js b/src/js/services/applicationService.js index c920a11cc..a694a86be 100644 --- a/src/js/services/applicationService.js +++ b/src/js/services/applicationService.js @@ -1,6 +1,6 @@ 'use strict'; angular.module('copayApp.services') - .factory('applicationService', function($rootScope, $timeout, isCordova, isChromeApp) { + .factory('applicationService', function($rootScope, $timeout, isCordova, isChromeApp, nodeWebkit, go) { var root = {}; root.restart = function() { @@ -14,7 +14,17 @@ angular.module('copayApp.services') } else { // Go home reloading the application if (isChromeApp) { - chrome.runtime.reload(); + if (nodeWebkit.isDefined()) { + go.walletHome(); + $timeout(function() { + var win = require('nw.gui').Window.get(); + win.reload(3); + //or + win.reloadDev(); + }, 100); + } else { + chrome.runtime.reload(); + } } else { window.location = window.location.href.substr(0, hashIndex); }