Merge pull request #2878 from cmgustavo/feat/copay-disclaimer

Copay: Terms of Use in APP
This commit is contained in:
Matias Alejo Garcia 2015-06-11 17:28:24 -03:00
commit bdc8bd52e4
10 changed files with 135 additions and 53 deletions

View File

@ -0,0 +1,20 @@
<div
ng-if="agreed && index.hasProfile"
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Terms of Use'; goBackToState = 'about'; noColor = true">
</div>
<div class="content p20v" ng-class="{'disclaimer':!index.hasProfile}">
<h1 class="text-center" ng-show="!index.hasProfile" translate>Terms of Use</h1>
<div class="p20h">
<p class="enable_text_select" translate>
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.
</p>
<button ng-show="!agreed" class="success round expand" ng-click="agree()" translate>
I affirm that I have read, understood, and agree with these terms.
</button>
<button ng-show="agreed && !index.hasProfile" class="round" ng-click="agree()" translate>Go back</button>
</div>
<div class="extra-margin-bottom"></div>
</div>

View File

@ -4,36 +4,39 @@
ng-init="titleSection='About Copay'; goBackToState = 'preferences'">
</div>
<div class="content p20v" ng-controller="preferencesAbout as about">
<ul class="no-bullet m0 size-14">
<div class="content preferences p20v" ng-controller="preferencesAbout as about">
<div class="text-center small-5 small-centered columns m20b" >
<img src="img/logo.png" alt="Copay" width="100%">
</div>
<h4 class="title m0" translate>Release Information</h4>
<div ng-controller="versionController as v">
<li class="line-b p20" ng-conf>
<span translate>Version</span>
<span class="right text-gray">
v{{v.version}}
</span>
</li>
<li class="line-b p20" ng-conf ng-click="$root.openExternalLink('https://github.com/bitpay/copay/tree/'+v.commitHash)">
<span translate>Commit hash</span>
<span class="right text-gray">
#{{v.commitHash}}
</span>
</li>
<ul class="no-bullet m0 size-14">
<li class="line-b p20" ng-conf>
<span translate>Version</span>
<span class="right text-gray">
v{{v.version}}
</span>
</li>
<li class="line-b p20" ng-conf ng-click="$root.openExternalLink('https://github.com/bitpay/copay/tree/'+v.commitHash)">
<span translate>Commit hash</span>
<span class="right text-gray">
#{{v.commitHash}}
</span>
</li>
</ul>
</div>
<h4 class="title m0">&nbsp;</h4>
<li class="line-b p20" ng-conf ng-click="$root.go('logs')">
<span translate>Session log</span>
<span class="right text-gray">
<ul class="no-bullet m0 size-14">
<li class="line-b p20" ng-click="$root.go('disclaimer')">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
</span>
</li>
</ul>
<span translate>Terms of Use</span>
</li>
<li class="line-b p20" ng-conf ng-click="$root.go('logs')">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<span translate>Session log</span>
</li>
</ul>
</div>

View File

@ -9,7 +9,7 @@
<div class="text-center text-warning m20b">
<i class="fi-alert"></i> <span translate>You do not have a wallet</span>
</div>
<button class="button black expand" ng-click="$root.go('add')" translate>Create</button>
<button class="button black round expand" ng-click="$root.go('add')" translate>Create</button>
<div class="text-center text-gray p20v" ng-click="$root.go('preferences')">
<button class=" outline round dark-gray tiny" translate> Preferences </button>

View File

@ -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;

View File

@ -565,6 +565,7 @@ to prevent collapsing during animation*/
width: 100%;
top: 45px;
padding-bottom: 33px;
-webkit-transform: translate3d(0,0,0);
}
.reveal-modal {

View File

@ -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();
});
};

View File

@ -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,32 @@ angular
}
}
})
$stateProvider
.state('disclaimer', {
url: '/disclaimer',
needProfile: false,
views: {
'main': {
templateUrl: 'views/disclaimer.html',
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) {
$timeout(function(){
applicationService.restart();
}, 1000);
});
};
}
}
}
})
.state('walletHome', {
url: '/',
walletShouldBeComplete: true,
@ -427,6 +457,7 @@ angular
preferencesEmail: 12,
about: 12,
logs: 13,
disclaimer: 13,
add: 11,
create: 12,
join: 12,
@ -451,6 +482,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
}

View File

@ -1,22 +1,30 @@
'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(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();
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);
}

View File

@ -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);
}
});
}
});
};

View File

@ -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;
});