Merge pull request #3474 from gabrielbazan7/feat/firstFlow1

licence and profile creation in the same view
This commit is contained in:
Matias Alejo Garcia 2015-11-18 10:15:00 -03:00
commit d37c167abb
9 changed files with 131 additions and 201 deletions

View file

@ -1,18 +1,20 @@
<div ng-controller="disclaimerController" ng-init="init()"> <div class="splash content text-center"
<div ng-controller="disclaimerController">
ng-if="agreed && index.hasProfile" <div>
class="topbar-container" <div class="row">
ng-include="'views/includes/topbar.html'" <div class="container-image large-2 medium-2 small-2 medium-centered small-centered large-centered columns">
ng-init="titleSection='Terms of Use'; goBackToState = 'about'; noColor = true"> <img src="img/icon-splash.png" alt="icon" width="100%">
</div> </div>
<div class="row">
<div class="content p20b" ng-class="{'disclaimer':!index.hasProfile}"> <div class="medium-centered small-centered large-centered columns">
<h4 class="title m0" ng-show="!index.hasProfile"> <span class="text-bold size-16 text-white" translate>WELCOME TO COPAY</span>
<div class="right">Copay</div> <p class="text-gray size-14 m0 text-light" translate>A multisignature bitcoin wallet</p>
<div translate>Terms of Use</div> </div>
</h4> </div>
<div class="p20h m10t"> <div class="row">
<p class="enable_text_select size-14"> <div class="scrollArea">
<p class="enable_text_select m0">
<div class="size-16 text-gray" translate>Terms of Use</div>
<ul> <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>
@ -28,20 +30,29 @@
<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> </p>
</div>
</div>
</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>
<p class="text-gray columns" translate>I affirm that I have read, understood, and agree with these terms.</p>
</div>
<div class="row">
<div ng-show="!agreed"> <div class="text-center size-12 text-warning" ng-show="error">
<p translate>I affirm that I have read, understood, and agree with these terms.</p> {{(error)|translate}}. <span translate>Retrying...</span>
<button class="black round expand" ng-click="agree()" ng-disabled="loading" translate> </div>
Agree
<div class="start-button columns">
<button ng-disabled="creatingProfile" ng-click="goHome()" class="button black expand round size-12 text-spacing" translate>
I AGREE. GET STARTED
</button> </button>
</div> </div>
<button ng-show="agreed && !index.hasProfile" class="round expand" ng-click="agree()" translate> </div>
Go back
</button>
</div>
<div class="extra-margin-bottom"></div>
</div> </div>
</div> </div>

View file

@ -1,43 +0,0 @@
<div class="splash content text-center"
ng-init="init()"
ng-controller="splashController">
<div ng-if="!index.hasProfile">
<div class="row">
<div class="medium-centered small-centered large-centered columns">
<div class="m20t">
<span class="text-bold size-16 text-white" translate>WELCOME TO COPAY</span>
<p class="text-gray size-14 m0 text-light" translate>A multisignature bitcoin wallet</p>
</div>
</div>
</div>
<div class="row">
<div class="container-image large-3 medium-3 small-3 medium-centered small-centered large-centered columns">
<img src="img/icon-splash.png" alt="icon" width="100%">
</div>
</div>
<div class="text-center size-12 text-warning" ng-show="error && !creatingProfile">
{{(error)|translate}}. <span translate>Retrying...</span>
</div>
<div class="onGoingProcess" ng-show="creatingProfile">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<span translate>Creating Profile...</span>
</div>
</div>
<div class="row" ng-show="!creatingProfile">
<div class="start-button large-8 medium-8 small-8 medium-centered small-centered large-centered columns">
<button ng-click="create()" class="button black expand round size-12 text-spacing" translate>
GET STARTED
</button>
<p class="text-gray m5b size-12" translate>Already have a wallet?</p>
<button ng-click="create(true)" class="button round outline dark-gray tiny" translate>Import backup </button>
</div>
</div>
</div>
</div>

View file

@ -7,7 +7,6 @@
font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
} }
.panel h1, .panel h2, .panel h3, .panel h4, .panel h5, .panel h6, .panel p, .panel li, .panel dl { .panel h1, .panel h2, .panel h3, .panel h4, .panel h5, .panel h6, .panel p, .panel li, .panel dl {
color: #2C3E50; color: #2C3E50;
} }
@ -1094,6 +1093,28 @@ input.ng-invalid-match, input.ng-invalid-match:focus {
} }
/*/////////////////////////////////////////////////*/ /*/////////////////////////////////////////////////*/
.scrollArea {
height: 280px;
overflow: scroll;
background: #213140;
border: 1px solid #4B6178;
border-radius: 5px;
margin: 1.6rem;
color: #A5B2BF;
line-height: 30px;
padding: 0.5rem;
}
.scrollArea ul {
font-size: 0.8rem;
text-align: justify;
margin-left: 0;
}
.scrollArea li {
list-style-type:none;
display: inline;
}
.tabbable { .tabbable {
border: 2px solid #213140; border: 2px solid #213140;
@ -1200,7 +1221,7 @@ input.ng-invalid-match, input.ng-invalid-match:focus {
} }
.splash .container-image { .splash .container-image {
padding: 2rem 0; padding: 1rem 0;
} }
.preferences li { .preferences li {

View file

@ -1,32 +1,37 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('disclaimerController', angular.module('copayApp.controllers').controller('disclaimerController',
function($scope, $timeout, storageService, applicationService, gettextCatalog, isCordova, uxLanguage) { function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, uxLanguage, go) {
self = this;
$scope.agree = function() {
if (isCordova) {
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Loading...'), true);
}
$scope.loading = true;
$timeout(function() {
storageService.setCopayDisclaimerFlag(function(err) {
$timeout(function() {
if (isCordova) {
window.plugins.spinnerDialog.hide();
}
applicationService.restart();
}, 1000);
});
}, 100);
};
$scope.init = function() {
storageService.getCopayDisclaimerFlag(function(err, val) {
$scope.lang = uxLanguage.currentLanguage; $scope.lang = uxLanguage.currentLanguage;
$scope.agreed = val;
$scope.goHome = function() {
go.walletHome();
};
var create = function() {
$scope.creatingProfile = true;
profileService.create({}, function(err) {
if (err) {
if (err == 'EEXISTS')
return go.walletHome();
$log.warn(err);
$scope.error = err;
$scope.$apply();
$timeout(function() { $timeout(function() {
$scope.$digest(); $log.warn('Retrying to create profile......');
}, 1); create();
}, 3000);
} else {
$scope.error = "";
$scope.creatingProfile = false;
}
}); });
}; };
create();
}); });

View file

@ -1295,7 +1295,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$on('Local/NewFocusedWallet', function() { $rootScope.$on('Local/NewFocusedWallet', function() {
self.setFocusedWallet(); self.setFocusedWallet();
self.updateTxHistory(); self.updateTxHistory();
go.walletHome();
storageService.getCleanAndScanAddresses(function(err, walletId) { storageService.getCleanAndScanAddresses(function(err, walletId) {
if (walletId && profileService.walletClients[walletId]) { if (walletId && profileService.walletClients[walletId]) {
$log.debug('Clear last address cache and Scan ', walletId); $log.debug('Clear last address cache and Scan ', walletId);

View file

@ -1,35 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('splashController',
function($scope, $timeout, $log, profileService, storageService, go) {
$scope.create = function(noWallet) {
$scope.creatingProfile = true;
$timeout(function() {
profileService.create({
noWallet: noWallet
}, function(err) {
if (err) {
$scope.creatingProfile = false;
$log.warn(err);
$scope.error = err;
$scope.$apply();
$timeout(function() {
$scope.create(noWallet);
}, 3000);
}
});
}, 100);
};
$scope.init = function() {
storageService.getCopayDisclaimerFlag(function(err, val) {
if (!val) go.path('disclaimer');
if (profileService.profile) {
go.walletHome();
}
});
};
});

View file

@ -75,17 +75,6 @@ angular
// link: http://stackoverflow.com/questions/15606751/angular-changes-urls-to-unsafe-in-extension-page?lq=1 // link: http://stackoverflow.com/questions/15606751/angular-changes-urls-to-unsafe-in-extension-page?lq=1
$compileProvider.imgSrcSanitizationWhitelist(/^\s*((https?|ftp|file|blob|chrome-extension):|data:image\/)/); $compileProvider.imgSrcSanitizationWhitelist(/^\s*((https?|ftp|file|blob|chrome-extension):|data:image\/)/);
$stateProvider
.state('splash', {
url: '/splash',
needProfile: false,
views: {
'main': {
templateUrl: 'views/splash.html',
}
}
});
$stateProvider $stateProvider
.state('translators', { .state('translators', {
url: '/translators', url: '/translators',
@ -521,9 +510,6 @@ angular
if (err) { if (err) {
if (err.message && err.message.match('NOPROFILE')) { if (err.message && err.message.match('NOPROFILE')) {
$log.debug('No profile... redirecting'); $log.debug('No profile... redirecting');
$state.transitionTo('splash');
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
$log.debug('Display disclaimer... redirecting');
$state.transitionTo('disclaimer'); $state.transitionTo('disclaimer');
} else { } else {
throw new Error(err); // TODO throw new Error(err); // TODO

View file

@ -134,10 +134,6 @@ angular.module('copayApp.services')
}; };
root.loadAndBindProfile = function(cb) { root.loadAndBindProfile = function(cb) {
storageService.getCopayDisclaimerFlag(function(err, val) {
if (!val) {
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
} else {
storageService.getProfile(function(err, profile) { storageService.getProfile(function(err, profile) {
if (err) { if (err) {
$rootScope.$emit('Local/DeviceError', err); $rootScope.$emit('Local/DeviceError', err);
@ -159,8 +155,6 @@ angular.module('copayApp.services')
} }
}); });
}
});
}; };
root._seedWallet = function(opts, cb) { root._seedWallet = function(opts, cb) {

View file

@ -199,14 +199,6 @@ angular.module('copayApp.services')
storage.remove('config', cb); 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) { root.setRemotePrefsStoredFlag = function(cb) {
storage.set('remotePrefStored', true, cb); storage.set('remotePrefStored', true, cb);
}; };