From b9557d47d24416178d1b8b0dcd0e757d3ff1261b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?=
Date: Mon, 30 Nov 2015 16:34:24 -0300
Subject: [PATCH] adding agreeDisclaimer flag for compatibility
---
public/views/disclaimer.html | 5 ++--
public/views/includes/terms.html | 31 +++++++++++------------
public/views/termOfUse.html | 29 ++++++++++++---------
src/js/controllers/disclaimer.js | 7 ++++--
src/js/routes.js | 42 +++++++++++++++++--------------
src/js/services/profileService.js | 12 +++++----
src/js/services/storageService.js | 5 ++++
7 files changed, 74 insertions(+), 57 deletions(-)
diff --git a/public/views/disclaimer.html b/public/views/disclaimer.html
index 81e0af61d..1014b3b68 100644
--- a/public/views/disclaimer.html
+++ b/public/views/disclaimer.html
@@ -12,8 +12,9 @@
diff --git a/public/views/includes/terms.html b/public/views/includes/terms.html
index a3f514f68..c66f1f02f 100644
--- a/public/views/includes/terms.html
+++ b/public/views/includes/terms.html
@@ -1,17 +1,14 @@
-
-
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.
-
-
+
+ - 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/termOfUse.html b/public/views/termOfUse.html
index 12fb4a98b..33804766d 100644
--- a/public/views/termOfUse.html
+++ b/public/views/termOfUse.html
@@ -1,13 +1,18 @@
-
+
-
-
-
-
diff --git a/src/js/controllers/disclaimer.js b/src/js/controllers/disclaimer.js
index b428aa19a..c26ddcb30 100644
--- a/src/js/controllers/disclaimer.js
+++ b/src/js/controllers/disclaimer.js
@@ -38,7 +38,10 @@ angular.module('copayApp.controllers').controller('disclaimerController',
storageService.getProfile(function(err, profile) {
if (!profile) create();
else $scope.creatingProfile = false;
+
+ //compatible
+ storageService.getCopayDisclaimerFlag(function(err, val) {
+ if (val) go.walletHome();
+ });
});
-
-
});
diff --git a/src/js/routes.js b/src/js/routes.js
index 6433dab2c..cd9b73558 100644
--- a/src/js/routes.js
+++ b/src/js/routes.js
@@ -473,26 +473,30 @@ angular
storageService.getProfile(function(err, profile) {
- $log.debug('### State: ', $stateParams.status);
- switch ($stateParams.status) {
- case 'resume':
- $rootScope.$emit('Local/Resume');
- break;
- case 'backbutton':
- var shouldExit = $stateParams.isHome == 'true' || !profile.agreeDisclaimer;
- if (isCordova && shouldExit && !$rootScope.modalOpened) {
- return navigator.app.exitApp();
- } else {
- $rootScope.$emit('closeModal');
- }
- break;
- };
+ //for compatibility
+ storageService.getCopayDisclaimerFlag(function(err, val) {
- if (profile.agreeDisclaimer) {
- go.walletHome(true);
- } else {
- $state.transitionTo('disclaimer');
- }
+ $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);
+ } else {
+ $state.transitionTo('disclaimer');
+ }
+ });
});
}
}
diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js
index 70efa5d15..4c1f5a117 100644
--- a/src/js/services/profileService.js
+++ b/src/js/services/profileService.js
@@ -134,7 +134,6 @@ angular.module('copayApp.services')
};
root.loadAndBindProfile = function(cb) {
-
storageService.getProfile(function(err, profile) {
if (err) {
$rootScope.$emit('Local/DeviceError', err);
@@ -151,10 +150,13 @@ angular.module('copayApp.services')
return root.bindProfile(profile, cb);
})
} else {
- if (!profile.agreeDisclaimer)
- return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
- $log.debug('Profile read');
- return root.bindProfile(profile, cb);
+ storageService.getCopayDisclaimerFlag(function(err, val) {
+ if (!profile.agreeDisclaimer) {
+ if (!val) return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
+ }
+ $log.debug('Profile read');
+ return root.bindProfile(profile, cb);
+ });
}
});
};
diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js
index 76bbf97c5..22ce21595 100644
--- a/src/js/services/storageService.js
+++ b/src/js/services/storageService.js
@@ -198,6 +198,11 @@ angular.module('copayApp.services')
storage.remove('config', cb);
};
+ //for compatibility
+ root.getCopayDisclaimerFlag = function(cb) {
+ storage.get('agreeDisclaimer', cb);
+ };
+
root.setRemotePrefsStoredFlag = function(cb) {
storage.set('remotePrefStored', true, cb);
};