From f23df02d0bae10407ad45d13b275f172435cc45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 23 Nov 2015 12:17:04 -0300 Subject: [PATCH 01/13] fix disclaimer --- src/js/controllers/disclaimer.js | 28 ++++++----- src/js/routes.js | 80 +++++++++++++++---------------- src/js/services/profileService.js | 45 +++++++++-------- src/js/services/storageService.js | 10 +++- 4 files changed, 89 insertions(+), 74 deletions(-) diff --git a/src/js/controllers/disclaimer.js b/src/js/controllers/disclaimer.js index 4d55984cc..725247970 100644 --- a/src/js/controllers/disclaimer.js +++ b/src/js/controllers/disclaimer.js @@ -6,7 +6,9 @@ angular.module('copayApp.controllers').controller('disclaimerController', $scope.lang = uxLanguage.currentLanguage; $scope.goHome = function() { - go.walletHome(); + storageService.setCopayDisclaimerFlag(function(err) { + go.walletHome(); + }); }; var create = function() { @@ -15,16 +17,20 @@ angular.module('copayApp.controllers').controller('disclaimerController', if (err) { - if (err == 'EEXISTS') - return go.walletHome(); - - $log.warn(err); - $scope.error = err; - $scope.$apply(); - $timeout(function() { - $log.warn('Retrying to create profile......'); - create(); - }, 3000); + if (err == 'EEXISTS') { + storageService.getCopayDisclaimerFlag(function(val) { + if (val) return go.walletHome(); + $scope.creatingProfile = false; + }); + } else { + $log.warn(err); + $scope.error = err; + $scope.$apply(); + $timeout(function() { + $log.warn('Retrying to create profile......'); + create(); + }, 3000); + } } else { $scope.error = ""; $scope.creatingProfile = false; diff --git a/src/js/routes.js b/src/js/routes.js index 90d408c3d..6e8c7d527 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -263,43 +263,39 @@ angular }, } }) - - .state('preferencesGlidera', { - url: '/preferencesGlidera', - walletShouldBeComplete: true, - needProfile: true, - views: { - 'main': { - templateUrl: 'views/preferencesGlidera.html' - }, - } - }) - - .state('preferencesAdvanced', { - url: '/preferencesAdvanced', - templateUrl: 'views/preferencesAdvanced.html', - walletShouldBeComplete: true, - needProfile: true, - views: { - 'main': { - templateUrl: 'views/preferencesAdvanced.html' - }, - } - }) - - .state('preferencesColor', { - url: '/preferencesColor', - templateUrl: 'views/preferencesColor.html', - walletShouldBeComplete: true, - needProfile: true, - views: { - 'main': { - templateUrl: 'views/preferencesColor.html' - }, - } - }) - - .state('preferencesAltCurrency', { + .state('preferencesGlidera', { + url: '/preferencesGlidera', + walletShouldBeComplete: true, + needProfile: true, + views: { + 'main': { + templateUrl: 'views/preferencesGlidera.html' + }, + } + }) + .state('preferencesAdvanced', { + url: '/preferencesAdvanced', + templateUrl: 'views/preferencesAdvanced.html', + walletShouldBeComplete: true, + needProfile: true, + views: { + 'main': { + templateUrl: 'views/preferencesAdvanced.html' + }, + } + }) + .state('preferencesColor', { + url: '/preferencesColor', + templateUrl: 'views/preferencesColor.html', + walletShouldBeComplete: true, + needProfile: true, + views: { + 'main': { + templateUrl: 'views/preferencesColor.html' + }, + } + }) + .state('preferencesAltCurrency', { url: '/preferencesAltCurrency', templateUrl: 'views/preferencesAltCurrency.html', walletShouldBeComplete: true, @@ -378,8 +374,7 @@ angular }, } }) - - .state('about', { + .state('about', { url: '/about', templateUrl: 'views/preferencesAbout.html', walletShouldBeComplete: true, @@ -449,8 +444,7 @@ angular templateUrl: 'views/warning.html', needProfile: false }) - - .state('add', { + .state('add', { url: '/add', needProfile: true, views: { @@ -516,13 +510,15 @@ angular // Give us time to open / create the profile event.preventDefault(); - // Try to open local profile profileService.loadAndBindProfile(function(err) { if (err) { if (err.message && err.message.match('NOPROFILE')) { $log.debug('No profile... redirecting'); $state.transitionTo('disclaimer'); + } else if (err.message && 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 12cd57065..a1b54c4f5 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -134,26 +134,31 @@ 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.getCopayDisclaimerFlag(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); + } + }); + } }); }; @@ -270,8 +275,8 @@ angular.module('copayApp.services') // check if exist if (lodash.find(root.profile.credentials, { - 'walletId': walletData.walletId - })) { + 'walletId': walletData.walletId + })) { return cb(gettext('Cannot join the same wallet more that once')); } } catch (ex) { diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js index 9178cb69c..e688b578e 100644 --- a/src/js/services/storageService.js +++ b/src/js/services/storageService.js @@ -65,7 +65,7 @@ angular.module('copayApp.services') return storage.set('profile', text, function(err) { return cb(err, text); }); - } catch(e) { + } catch (e) { $log.warn('Decrypt error: ', e); return cb('Could not decrypt storage: device ID mismatch'); }; @@ -199,6 +199,14 @@ angular.module('copayApp.services') storage.remove('config', cb); }; + root.setCopayDisclaimerFlag = function(cb) { + storage.set('agreeDisclaimer', true, cb); + }; + + root.getCopayDisclaimerFlag = function(cb) { + storage.get('agreeDisclaimer', cb); + }; + root.setRemotePrefsStoredFlag = function(cb) { storage.set('remotePrefStored', true, cb); }; From 999c3e7d5d7259b54398b74d042951677f680870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 23 Nov 2015 13:18:38 -0300 Subject: [PATCH 02/13] fix go home problem --- src/js/controllers/disclaimer.js | 2 +- src/js/controllers/index.js | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/js/controllers/disclaimer.js b/src/js/controllers/disclaimer.js index 725247970..b07b97462 100644 --- a/src/js/controllers/disclaimer.js +++ b/src/js/controllers/disclaimer.js @@ -18,7 +18,7 @@ angular.module('copayApp.controllers').controller('disclaimerController', if (err) { if (err == 'EEXISTS') { - storageService.getCopayDisclaimerFlag(function(val) { + storageService.getCopayDisclaimerFlag(function(err, val) { if (val) return go.walletHome(); $scope.creatingProfile = false; }); diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index f75651ccb..38fc751bb 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -1325,14 +1325,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r $rootScope.$on('Local/NewFocusedWallet', function() { self.setFocusedWallet(); self.updateTxHistory(); - storageService.getCleanAndScanAddresses(function(err, walletId) { - if (walletId && profileService.walletClients[walletId]) { - $log.debug('Clear last address cache and Scan ', walletId); - addressService.expireAddress(walletId, function(err) { - self.startScan(walletId); - }); - storageService.removeCleanAndScanAddresses(function() {}); - } + storageService.getCopayDisclaimerFlag(function(err, val) { + if (val) go.walletHome(); + storageService.getCleanAndScanAddresses(function(err, walletId) { + if (walletId && profileService.walletClients[walletId]) { + $log.debug('Clear last address cache and Scan ', walletId); + addressService.expireAddress(walletId, function(err) { + self.startScan(walletId); + }); + storageService.removeCleanAndScanAddresses(function() {}); + } + }); }); }); From 93e9fa7d3bc04fca5137a341d0452862bc3dd828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Tue, 24 Nov 2015 12:21:13 -0300 Subject: [PATCH 03/13] fix bugs in phone --- public/index.html | 2 +- src/js/controllers/index.js | 3 +++ src/js/routes.js | 15 ++++++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/public/index.html b/public/index.html index 56a114dec..703186195 100644 --- a/public/index.html +++ b/public/index.html @@ -18,7 +18,7 @@ ng-controller="indexController as index" ng-swipe-disable-mouse ng-swipe-left="index.closeMenu()" - ng-swipe-right="index.openMenu()"> + ng-swipe-right="index.agreeDisclaimer ? index.openMenu()">
diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 38fc751bb..2ed1da44e 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -135,6 +135,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.openWallet(); }); } + storageService.getCopayDisclaimerFlag(function(err, val) { + self.agreeDisclaimer = val; + }); }); }; diff --git a/src/js/routes.js b/src/js/routes.js index 6e8c7d527..00bce5d32 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -457,7 +457,8 @@ angular url: '/cordova/:status/:isHome', views: { 'main': { - controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) { + controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova, storageService) { + switch ($stateParams.status) { case 'resume': $rootScope.$emit('Local/Resume'); @@ -470,10 +471,14 @@ angular } break; }; - $timeout(function() { - $rootScope.$emit('Local/SetTab', 'walletHome', true); - }, 100); - go.walletHome(); + storageService.getCopayDisclaimerFlag(function(err, val) { + if (!val) navigator.app.exitApp(); + + $timeout(function() { + $rootScope.$emit('Local/SetTab', 'walletHome', true); + }, 100); + go.walletHome(); + }); } } }, From 4061c807c1f0e6ff268b3d679b3212d8baf65fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Tue, 24 Nov 2015 12:32:09 -0300 Subject: [PATCH 04/13] condition error --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 703186195..4378640a5 100644 --- a/public/index.html +++ b/public/index.html @@ -18,7 +18,7 @@ ng-controller="indexController as index" ng-swipe-disable-mouse ng-swipe-left="index.closeMenu()" - ng-swipe-right="index.agreeDisclaimer ? index.openMenu()"> + ng-swipe-right="index.agreeDisclaimer ? index.openMenu() : null">
From fd32a1ec915caa37252f8d9dfe8bcb0532193cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Tue, 24 Nov 2015 17:16:52 -0300 Subject: [PATCH 05/13] fix blank page --- src/js/controllers/disclaimer.js | 12 ++++----- src/js/routes.js | 42 ++++++++++++++++++-------------- src/js/services/go.js | 21 ++++++++++------ 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/src/js/controllers/disclaimer.js b/src/js/controllers/disclaimer.js index b07b97462..7e3b5a244 100644 --- a/src/js/controllers/disclaimer.js +++ b/src/js/controllers/disclaimer.js @@ -1,10 +1,9 @@ 'use strict'; angular.module('copayApp.controllers').controller('disclaimerController', - function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, uxLanguage, go) { + function($scope, $timeout, $log, profileService, isCordova, storageService, applicationService, gettextCatalog, uxLanguage, go) { self = this; $scope.lang = uxLanguage.currentLanguage; - $scope.goHome = function() { storageService.setCopayDisclaimerFlag(function(err) { go.walletHome(); @@ -16,14 +15,13 @@ angular.module('copayApp.controllers').controller('disclaimerController', profileService.create({}, function(err) { if (err) { - + $log.warn(err); if (err == 'EEXISTS') { storageService.getCopayDisclaimerFlag(function(err, val) { if (val) return go.walletHome(); $scope.creatingProfile = false; }); } else { - $log.warn(err); $scope.error = err; $scope.$apply(); $timeout(function() { @@ -38,6 +36,8 @@ angular.module('copayApp.controllers').controller('disclaimerController', }); }; - create(); - + if (!profileService.profile) + create(); + else + applicationService.restart(); }); diff --git a/src/js/routes.js b/src/js/routes.js index 00bce5d32..705bd736c 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -457,27 +457,33 @@ angular url: '/cordova/:status/:isHome', views: { 'main': { - controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova, storageService) { + controller: function($rootScope, $state, $log, $stateParams, $timeout, go, isCordova, storageService) { + + if ($stateParams.status == "pause") + return; - switch ($stateParams.status) { - case 'resume': - $rootScope.$emit('Local/Resume'); - break; - case 'backbutton': - if (isCordova && $stateParams.isHome == 'true' && !$rootScope.modalOpened) { - navigator.app.exitApp(); - } else { - $rootScope.$emit('closeModal'); - } - break; - }; storageService.getCopayDisclaimerFlag(function(err, val) { - if (!val) navigator.app.exitApp(); - $timeout(function() { - $rootScope.$emit('Local/SetTab', 'walletHome', true); - }, 100); - go.walletHome(); + $log.debug('### State: ', $stateParams.status); + switch ($stateParams.status) { + case 'resume': + $rootScope.$emit('Local/Resume'); + break; + case 'backbutton': + var shouldExit = $stateParams.isHome == 'true' || !val; + if (isCordova && shouldExit && !$rootScope.modalOpened) { + return navigator.app.exitApp(); + } else { + $rootScope.$emit('closeModal'); + } + break; + }; + + if (val) { + go.walletHome(true); + } else { + $state.transitionTo('disclaimer'); + } }); } } diff --git a/src/js/services/go.js b/src/js/services/go.js index eb09e5d41..0ae7fa993 100644 --- a/src/js/services/go.js +++ b/src/js/services/go.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.services').factory('go', function($window, $rootScope, $location, $state, profileService, nodeWebkit) { +angular.module('copayApp.services').factory('go', function($window, $rootScope, $location, $state, $timeout, profileService, nodeWebkit) { var root = {}; var hideSidebars = function() { @@ -32,8 +32,7 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope, root.openExternalLink = function(url, target) { if (nodeWebkit.isDefined()) { nodeWebkit.openExternalLink(url); - } - else { + } else { target = target || '_blank'; var ref = window.open(url, target, 'location=no'); } @@ -53,14 +52,22 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope, toggleSidebar(invert); }; - root.walletHome = function() { + root.walletHome = function(delayed) { var fc = profileService.focusedClient; if (fc && !fc.isComplete()) { root.path('copayers'); } else { - root.path('walletHome', function() { - $rootScope.$emit('Local/SetTab', 'walletHome', true); - }); + if (delayed) { + $timeout(function() { + root.path('walletHome', function() { + $rootScope.$emit('Local/SetTab', 'walletHome', true); + }); + }, 100); + } else { + root.path('walletHome', function() { + $rootScope.$emit('Local/SetTab', 'walletHome', true); + }); + } } }; From 42aaf515c7fe5dd643aa01ec3017da70a82163d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 25 Nov 2015 10:04:43 -0300 Subject: [PATCH 06/13] include terms.html --- public/views/disclaimer.html | 19 +------------------ public/views/includes/terms.html | 17 +++++++++++++++++ public/views/preferencesAbout.html | 2 +- public/views/termOfUse.html | 13 +++++++++++++ src/js/routes.js | 9 +++++++++ 5 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 public/views/includes/terms.html create mode 100644 public/views/termOfUse.html diff --git a/public/views/disclaimer.html b/public/views/disclaimer.html index 9c4cd2a92..9f313c7a2 100644 --- a/public/views/disclaimer.html +++ b/public/views/disclaimer.html @@ -12,24 +12,7 @@
-
-

-

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/includes/terms.html b/public/views/includes/terms.html new file mode 100644 index 000000000..a3f514f68 --- /dev/null +++ b/public/views/includes/terms.html @@ -0,0 +1,17 @@ +

+

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 703534699..bde19af47 100644 --- a/public/views/preferencesAbout.html +++ b/public/views/preferencesAbout.html @@ -25,7 +25,7 @@

    -
  • +
  • Terms of Use
  • diff --git a/public/views/termOfUse.html b/public/views/termOfUse.html new file mode 100644 index 000000000..12fb4a98b --- /dev/null +++ b/public/views/termOfUse.html @@ -0,0 +1,13 @@ +
    +
    + +
    + +
    diff --git a/src/js/routes.js b/src/js/routes.js index 705bd736c..118a25b80 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -438,6 +438,15 @@ angular }, } }) + .state('termOfUse', { + url: '/termOfUse', + needProfile: true, + views: { + 'main': { + templateUrl: 'views/termOfUse.html', + }, + } + }) .state('warning', { url: '/warning', controller: 'warningController', From 3f7485ca8d582a4ecbaac486ebaf9a454b695930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 30 Nov 2015 12:58:52 -0300 Subject: [PATCH 07/13] deleting agree disclaimer flag in storage and adding to the storage profile --- public/views/disclaimer.html | 14 ++++++++- src/js/controllers/disclaimer.js | 26 +++++++++------- src/js/controllers/index.js | 10 +++---- src/js/models/profile.js | 6 ++-- src/js/routes.js | 6 ++-- src/js/services/profileService.js | 49 +++++++++++++++---------------- src/js/services/storageService.js | 9 ------ 7 files changed, 62 insertions(+), 58 deletions(-) diff --git a/public/views/disclaimer.html b/public/views/disclaimer.html index 9f313c7a2..ec96a356a 100644 --- a/public/views/disclaimer.html +++ b/public/views/disclaimer.html @@ -1,4 +1,5 @@
    @@ -30,7 +31,18 @@
    {{(error)|translate}}. Retrying...
    - +
    +
    +
    +
    +
    +
    +
    +
    +
    + Creating Profile... +
    +
    -

    -

    -

    +
    +

    +

    Terms of Use
    +
    +

    +
    From 17003bc1c18d6fe56de95fff956e258a667980f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 30 Nov 2015 17:33:39 -0300 Subject: [PATCH 11/13] term of use page fixes --- public/index.html | 2 +- public/views/termOfUse.html | 14 ++++++-------- src/js/controllers/index.js | 15 ++++++++++----- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/public/index.html b/public/index.html index 4378640a5..3e763dc79 100644 --- a/public/index.html +++ b/public/index.html @@ -18,7 +18,7 @@ ng-controller="indexController as index" ng-swipe-disable-mouse ng-swipe-left="index.closeMenu()" - ng-swipe-right="index.agreeDisclaimer ? index.openMenu() : null"> + ng-swipe-right="index.agreeDisclaimer() ? index.openMenu() : null">
    diff --git a/public/views/termOfUse.html b/public/views/termOfUse.html index 33804766d..506a2a3fa 100644 --- a/public/views/termOfUse.html +++ b/public/views/termOfUse.html @@ -1,18 +1,16 @@ -
    - diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 0ce9873c1..acdf30dff 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -135,9 +135,14 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.openWallet(); }); } - storageService.getProfile(function(err, profile) { - self.agreeDisclaimer = profile.agreeDisclaimer; - }); + }); + }; + + self.agreeDisclaimer = function() { + storageService.getProfile(function(err, profile) { + if (profile && profile.agreeDisclaimer) + return profile.agreeDisclaimer; + return null; }); }; @@ -1328,8 +1333,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r $rootScope.$on('Local/NewFocusedWallet', function() { self.setFocusedWallet(); self.updateTxHistory(); - storageService.getProfile(function(err, val) { - if (val.agreeDisclaimer) go.walletHome(); + storageService.getProfile(function(err, profile) { + if (profile && profile.agreeDisclaimer) go.walletHome(); storageService.getCleanAndScanAddresses(function(err, walletId) { if (walletId && profileService.walletClients[walletId]) { $log.debug('Clear last address cache and Scan ', walletId); From 3a383844519975beb65c6635a8b03ef76c87e2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 30 Nov 2015 17:52:09 -0300 Subject: [PATCH 12/13] adding term of use animation, and taking out animation in initial disclaimer page --- src/js/services/animationService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/services/animationService.js b/src/js/services/animationService.js index c1dbbd549..75586a3c2 100644 --- a/src/js/services/animationService.js +++ b/src/js/services/animationService.js @@ -42,8 +42,8 @@ angular.module('copayApp.services').factory('animationService', function(isCordo paperWallet: 13, logs: 13, information: 13, + termOfUse: 13, translators: 13, - disclaimer: 13, add: 11, create: 12, join: 12, From 1b38a4229254e1c91ba00189440cba4ac9cdc180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 30 Nov 2015 18:57:18 -0300 Subject: [PATCH 13/13] refactor --- src/js/routes.js | 45 +++++++++++++++---------------------------- src/js/services/go.js | 14 +++----------- 2 files changed, 18 insertions(+), 41 deletions(-) diff --git a/src/js/routes.js b/src/js/routes.js index cd9b73558..60db0e35d 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -466,38 +466,23 @@ angular url: '/cordova/:status/:isHome', views: { 'main': { - controller: function($rootScope, $state, $log, $stateParams, $timeout, go, isCordova, storageService) { - - if ($stateParams.status == "pause") - return; - - storageService.getProfile(function(err, profile) { - - //for compatibility - storageService.getCopayDisclaimerFlag(function(err, val) { - - $log.debug('### State: ', $stateParams.status); - switch ($stateParams.status) { - case 'resume': - $rootScope.$emit('Local/Resume'); - break; - case 'backbutton': - var shouldExit = $stateParams.isHome == 'true' || !profile.agreeDisclaimer || !val; - if (isCordova && shouldExit && !$rootScope.modalOpened) { - return navigator.app.exitApp(); - } else { - $rootScope.$emit('closeModal'); - } - break; - }; - - if (profile.agreeDisclaimer || val) { - go.walletHome(true); + controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) { + switch ($stateParams.status) { + case 'resume': + $rootScope.$emit('Local/Resume'); + break; + case 'backbutton': + if (isCordova && $stateParams.isHome == 'true' && !$rootScope.modalOpened) { + navigator.app.exitApp(); } else { - $state.transitionTo('disclaimer'); + $rootScope.$emit('closeModal'); } - }); - }); + break; + }; + $timeout(function() { + $rootScope.$emit('Local/SetTab', 'walletHome', true); + }, 100); + go.walletHome(); } } }, diff --git a/src/js/services/go.js b/src/js/services/go.js index 0ae7fa993..73c51493f 100644 --- a/src/js/services/go.js +++ b/src/js/services/go.js @@ -57,17 +57,9 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope, if (fc && !fc.isComplete()) { root.path('copayers'); } else { - if (delayed) { - $timeout(function() { - root.path('walletHome', function() { - $rootScope.$emit('Local/SetTab', 'walletHome', true); - }); - }, 100); - } else { - root.path('walletHome', function() { - $rootScope.$emit('Local/SetTab', 'walletHome', true); - }); - } + root.path('walletHome', function() { + $rootScope.$emit('Local/SetTab', 'walletHome', true); + }); } };