improve navigation functions

This commit is contained in:
Javier 2015-11-26 17:42:04 -03:00
commit 7941b7a0ef
2 changed files with 21 additions and 72 deletions

View file

@ -1,7 +1,7 @@
<div class="backup" ng-controller="backupController as wordsC"> <div class="backup" ng-controller="backupController as wordsC">
<nav class="tab-bar"> <nav class="tab-bar">
<section class="left-small" ng-show="!wordsC.step1 && !wordsC.step4"> <section class="left-small" ng-show="(wordsC.step != 1 && wordsC.step != 4)">
<a ng-click="wordsC.goToStep();"> <a ng-click="wordsC.goToStep(1);">
<i class="icon-arrow-left3 icon-back"></i> <i class="icon-arrow-left3 icon-back"></i>
</a> </a>
</section> </section>
@ -29,7 +29,7 @@
## STEP 1 ## STEP 1
--> -->
<div ng-show="wordsC.step1"> <div ng-show="wordsC.step == 1">
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)"> <div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)">
<h5 class="text-center">Write your wallet seed</h5> <h5 class="text-center">Write your wallet seed</h5>
<div class="size-14 text-gray" ng-show="(index.n>1 && index.m != index.n )"> <div class="size-14 text-gray" ng-show="(index.n>1 && index.m != index.n )">
@ -62,7 +62,7 @@
</div> </div>
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)"> <div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)">
<p class="text-center columns text-gray" ng-show="index.n==1 && wordsC.step1"> <p class="text-center columns text-gray" ng-show="index.n==1 && wordsC.step == 1">
<span translate> <span translate>
You need the wallet seed to restore this personal wallet. Write it down and keep them somewhere safe. You need the wallet seed to restore this personal wallet. Write it down and keep them somewhere safe.
</span> </span>
@ -99,7 +99,7 @@
ng-disabled="wordsC.credentialsEncrypted" ng-disabled="wordsC.credentialsEncrypted"
class="round expand m0" class="round expand m0"
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
ng-click="wordsC.goToStep2();" ng-click="wordsC.goToStep(2);"
translate>Continue translate>Continue
</button> </button>
</div> </div>
@ -109,7 +109,7 @@
## STEP 2 ## STEP 2
--> -->
<div ng-show="wordsC.step2"> <div ng-show="wordsC.step == 2">
<div class="columns text-center"> <div class="columns text-center">
<h5>Confirm your wallet seed</h5> <h5>Confirm your wallet seed</h5>
<p class="text-gray m0"> <p class="text-gray m0">
@ -130,7 +130,7 @@
ng-disabled="!wordsC.selectComplete" ng-disabled="!wordsC.selectComplete"
class="round expand m0" class="round expand m0"
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
ng-click="wordsC.goToStep3();" ng-click="wordsC.goToStep(3);"
translate>Continue translate>Continue
</button> </button>
</div> </div>
@ -140,7 +140,7 @@
## STEP 3 ## STEP 3
--> -->
<div ng-show="wordsC.step3"> <div ng-show="wordsC.step == 3">
<div class="columns text-center"> <div class="columns text-center">
<h5> Enter your passphrase</h5> <h5> Enter your passphrase</h5>
<p class="text-gray m0"> <p class="text-gray m0">
@ -156,7 +156,7 @@
ng-disabled="!passphrase" ng-disabled="!passphrase"
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
class="button round expand m0" class="button round expand m0"
ng-click="wordsC.goToStep4();" ng-click="wordsC.goToStep(4);"
translate>Continue translate>Continue
</button> </button>
</div> </div>
@ -166,13 +166,7 @@
## STEP 4 ## STEP 4
--> -->
<div ng-show="wordsC.step4"> <div ng-show="wordsC.step == 4">
<!-- <div class="box-notification" ng-show="wordsC.backupError">
<span class="text-warning" translate>
Failed to verify backup. Please try again
</span>
</div> -->
<div class="row m10t m10b text-center" ng-show="!wordsC.backupError"> <div class="row m10t m10b text-center" ng-show="!wordsC.backupError">
<div class="circle-icon"> <div class="circle-icon">
<i class="fi-like size-48"></i> <i class="fi-like size-48"></i>
@ -215,7 +209,7 @@
<button <button
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
class="button round expand" class="button round expand"
ng-click="wordsC.goToStep1();" ng-click="wordsC.goToStep(1);"
translate>Try again translate>Try again
</button> </button>
<!-- hide this in multisig just to show less text --> <!-- hide this in multisig just to show less text -->

View file

@ -14,10 +14,7 @@ angular.module('copayApp.controllers').controller('backupController',
customWords = []; customWords = [];
mnemonic = null; mnemonic = null;
self.xPrivKey = null; self.xPrivKey = null;
self.step1 = true; self.step = 1;
self.step2 = false;
self.step3 = false;
self.step4 = false;
self.deleted = false; self.deleted = false;
self.credentialsEncrypted = false; self.credentialsEncrypted = false;
self.selectComplete = false; self.selectComplete = false;
@ -42,59 +39,17 @@ angular.module('copayApp.controllers').controller('backupController',
return mnemonic; return mnemonic;
} }
self.goToStep = function() { self.goToStep = function(n) {
if (self.step2) { self.step = n;
self.goToStep1(); if (self.step == 1)
} else if (self.step3) { init();
self.goToStep2(); if (self.step == 3 && !self.mnemonicHasPassphrase)
self.step++;
if (self.step == 4) {
confirm();
} }
} }
self.goToStep1 = function() {
init();
$timeout(function() {
$scope.$apply();
}, 1);
}
self.goToStep2 = function() {
self.step1 = false;
self.step2 = true;
self.step3 = false;
self.step4 = false;
$timeout(function() {
$scope.$apply();
}, 1);
}
self.goToStep3 = function() {
if (self.mnemonicHasPassphrase) {
self.step1 = false;
self.step2 = false;
self.step3 = true;
self.step4 = false;
} else {
self.goToStep4();
}
$timeout(function() {
$scope.$apply();
}, 1);
}
self.goToStep4 = function() {
self.confirm();
self.step1 = false;
self.step2 = false;
self.step3 = false;
self.step4 = true;
$timeout(function() {
$scope.$apply();
}, 1);
}
function setWords(words) { function setWords(words) {
if (words) { if (words) {
self.mnemonicWords = words.split(/[\u3000\s]+/); self.mnemonicWords = words.split(/[\u3000\s]+/);
@ -187,7 +142,7 @@ angular.module('copayApp.controllers').controller('backupController',
self.selectComplete = false; self.selectComplete = false;
} }
self.confirm = function() { function confirm() {
self.backupError = false; self.backupError = false;
var walletClient = bwcService.getClient(); var walletClient = bwcService.getClient();