fix navigation top control

This commit is contained in:
Javier 2015-11-23 17:53:42 -03:00
parent 32a1817ccb
commit 9a806f3bab
3 changed files with 79 additions and 32 deletions

View File

@ -1,16 +1,27 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Backup'; closeToHome = 'true'">
</div>
<div class="" ng-controller="backupController as wordsC">
<nav class="tab-bar">
<section class="left-small" ng-show="!wordsC.step1 && !wordsC.step4">
<a ng-click="wordsC.goToStep();">
<i class="icon-arrow-left3 icon-back"></i>
</a>
</section>
<div class="content preferences backup" ng-controller="backupController as wordsC">
<h4></h4>
<div class="box-notification" ng-show="wordsC.error">
<span class="text-warning">
{{wordsC.error|translate}}
</span>
</div>
<section class="middle tab-bar-section">
</section>
<section class="right-small">
<a class="p10" ng-click="$root.go(index.prevState);">
<span class="text-close">X</span>
</a>
</section>
</nav>
<div class="content preferences backup">
<div class="box-notification" ng-show="wordsC.error">
<span class="text-warning" translate>
{{wordsC.error}}
</span>
</div>
<!--
## STEP 1
@ -169,24 +180,33 @@
<p class="text-gray p20" translate>
You backed up your new wallet. You can now restore this wallet at any time
</p>
<div class="columns text-center m20t">
<button
ng-style="{'background-color':index.backgroundColor}"
class="button round expand"
ng-click="$root.go('walletHome');"
translate>Finish
</button>
</div>
</div>
<div class="row m10t m10b text-center" ng-show="wordsC.backupError">
<div class="circle-icon">
<i class="fi-like size-48"></i>
<i class="fi-dislike size-48"></i>
</div>
<h5>Backup failed</h5>
<p class="text-gray p20" translate>
Failed to verify backup. Please try again
Failed to verify backup. Please check your information
</p>
</div>
<div class="columns text-center m20t">
<button
ng-style="{'background-color':index.backgroundColor}"
class="button round expand"
ng-click="$root.go('walletHome');"
translate>Finish
</button>
<div class="columns text-center m20t">
<button
ng-style="{'background-color':index.backgroundColor}"
class="button round expand"
ng-click="$root.go(index.prevState);"
translate>Try again
</button>
</div>
</div>
</div>

View File

@ -7,15 +7,22 @@ angular.module('copayApp.controllers').controller('backupController',
var fc = profileService.focusedClient;
var customWords = [];
var mnemonic = null;
self.xPrivKey = null;
self.step1 = true;
self.step2 = false;
self.step3 = false;
self.step4 = false;
self.deleted = false;
self.credentialsEncrypted = false;
self.selectComplete = false;
self.backupError = false;
function init() {
customWords = [];
mnemonic = null;
self.xPrivKey = null;
self.step1 = true;
self.step2 = false;
self.step3 = false;
self.step4 = false;
self.deleted = false;
self.credentialsEncrypted = false;
self.selectComplete = false;
self.backupError = false;
}
init();
if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic)
self.deleted = true;
@ -33,6 +40,21 @@ angular.module('copayApp.controllers').controller('backupController',
return mnemonic;
}
self.goToStep = function() {
if (self.step2) {
self.goToStep1();
} else if (self.step3) {
self.goToStep2();
}
}
self.goToStep1 = function() {
init();
$timeout(function() {
$scope.$apply();
}, 1);
}
self.goToStep2 = function() {
self.step1 = false;
self.step2 = true;

View File

@ -9,6 +9,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.onGoingProcess = {};
self.historyShowLimit = 10;
self.updatingTxHistory = {};
self.prevState = 'walletHome';
function strip(number) {
return (parseFloat(number.toPrecision(12)));
@ -1097,6 +1098,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
};
$rootScope.$on('$stateChangeSuccess', function(ev, to, toParams, from, fromParams) {
self.prevState = from.name || 'walletHome';
});
$rootScope.$on('Local/ClearHistory', function(event) {
$log.debug('The wallet transaction history has been deleted');
self.txHistory = self.completeHistory = [];