adding agreeDisclaimer flag for compatibility

This commit is contained in:
Gabriel Bazán 2015-11-30 16:34:24 -03:00
commit b9557d47d2
7 changed files with 74 additions and 57 deletions

View file

@ -12,8 +12,9 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="scrollArea" ng-include="'views/includes/terms.html'"> <p class="enable_text_select m0">
</div> <div class="scrollArea" ng-include="'views/includes/terms.html'"></div>
</p>
</div> </div>
</div> </div>

View file

@ -1,6 +1,4 @@
<p class="enable_text_select m0"> <ul>
<div class="size-16 text-gray" translate>Terms of Use</div>
<ul>
<li translate>The software you are about to use functions as a free, open source, and multi-signature digital wallet.</li> <li translate>The software you are about to use functions as a free, open source, and multi-signature digital wallet.</li>
<li translate>The software does not constitute an account where BitPay or other third parties serve as financial intermediaries or custodians of your bitcoin.</li> <li translate>The software does not constitute an account where BitPay or other third parties serve as financial intermediaries or custodians of your bitcoin.</li>
<li translate>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.</li> <li translate>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.</li>
@ -13,5 +11,4 @@
<li translate>You assume any and all risks associated with the use of the software.</li> <li translate>You assume any and all risks associated with the use of the software.</li>
<li translate>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.</li> <li translate>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.</li>
<li translate>We reserve the right to modify this disclaimer from time to time.</li> <li translate>We reserve the right to modify this disclaimer from time to time.</li>
</ul> </ul>
</p>

View file

@ -1,13 +1,18 @@
<div <div class="splash content text-center">
<div
class="topbar-container" class="topbar-container"
ng-include="'views/includes/topbar.html'" ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Terms of use'; goBackToState = 'about'; noColor = true"> ng-init="titleSection='Terms of use'; goBackToState = 'about'; noColor = true">
</div> </div>
<div class="scrollArea" style="height: 80vh;">
<div ng-include="'views/includes/terms.html'"></div> <p class="enable_text_select m0">
<div class="row"> <div ng-include="'views/includes/terms.html'"></div>
</p>
</div>
<div class="row">
<p ng-show="lang != 'en'"> <p ng-show="lang != 'en'">
<a class="center" ng-click="$root.openExternalLink('https://copay.io/disclaimer')" translate>Official English Disclaimer</a> <a class="center" ng-click="$root.openExternalLink('https://copay.io/disclaimer')" translate>Official English Disclaimer</a>
</p> </p>
</div>
<div class="extra-margin-bottom"></div>
</div> </div>
<div class="extra-margin-bottom"></div>

View file

@ -38,7 +38,10 @@ angular.module('copayApp.controllers').controller('disclaimerController',
storageService.getProfile(function(err, profile) { storageService.getProfile(function(err, profile) {
if (!profile) create(); if (!profile) create();
else $scope.creatingProfile = false; else $scope.creatingProfile = false;
});
//compatible
storageService.getCopayDisclaimerFlag(function(err, val) {
if (val) go.walletHome();
});
});
}); });

View file

@ -473,13 +473,16 @@ angular
storageService.getProfile(function(err, profile) { storageService.getProfile(function(err, profile) {
//for compatibility
storageService.getCopayDisclaimerFlag(function(err, val) {
$log.debug('### State: ', $stateParams.status); $log.debug('### State: ', $stateParams.status);
switch ($stateParams.status) { switch ($stateParams.status) {
case 'resume': case 'resume':
$rootScope.$emit('Local/Resume'); $rootScope.$emit('Local/Resume');
break; break;
case 'backbutton': case 'backbutton':
var shouldExit = $stateParams.isHome == 'true' || !profile.agreeDisclaimer; var shouldExit = $stateParams.isHome == 'true' || !profile.agreeDisclaimer || !val;
if (isCordova && shouldExit && !$rootScope.modalOpened) { if (isCordova && shouldExit && !$rootScope.modalOpened) {
return navigator.app.exitApp(); return navigator.app.exitApp();
} else { } else {
@ -488,12 +491,13 @@ angular
break; break;
}; };
if (profile.agreeDisclaimer) { if (profile.agreeDisclaimer || val) {
go.walletHome(true); go.walletHome(true);
} else { } else {
$state.transitionTo('disclaimer'); $state.transitionTo('disclaimer');
} }
}); });
});
} }
} }
}, },

View file

@ -134,7 +134,6 @@ angular.module('copayApp.services')
}; };
root.loadAndBindProfile = function(cb) { root.loadAndBindProfile = function(cb) {
storageService.getProfile(function(err, profile) { storageService.getProfile(function(err, profile) {
if (err) { if (err) {
$rootScope.$emit('Local/DeviceError', err); $rootScope.$emit('Local/DeviceError', err);
@ -151,10 +150,13 @@ angular.module('copayApp.services')
return root.bindProfile(profile, cb); return root.bindProfile(profile, cb);
}) })
} else { } else {
if (!profile.agreeDisclaimer) storageService.getCopayDisclaimerFlag(function(err, val) {
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer')); if (!profile.agreeDisclaimer) {
if (!val) return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
}
$log.debug('Profile read'); $log.debug('Profile read');
return root.bindProfile(profile, cb); return root.bindProfile(profile, cb);
});
} }
}); });
}; };

View file

@ -198,6 +198,11 @@ angular.module('copayApp.services')
storage.remove('config', cb); storage.remove('config', cb);
}; };
//for compatibility
root.getCopayDisclaimerFlag = function(cb) {
storage.get('agreeDisclaimer', cb);
};
root.setRemotePrefsStoredFlag = function(cb) { root.setRemotePrefsStoredFlag = function(cb) {
storage.set('remotePrefStored', true, cb); storage.set('remotePrefStored', true, cb);
}; };