This commit is contained in:
Matias Alejo Garcia 2014-12-06 15:30:32 -03:00
commit de54f3aac8
6 changed files with 13 additions and 32 deletions

View file

@ -62,7 +62,7 @@
<section class="left-small"> <section class="left-small">
<a class="left-off-canvas-toggle menu-icon" ><span></span></a> <a class="left-off-canvas-toggle menu-icon" ><span></span></a>
</section> </section>
<section class="right-small"> <section class="right-small" ng-if="$root.iden && $root.iden.listWallets().length >1">
<a class="right-off-canvas-toggle p10"><i class="icon-wallet size-24"></i></a> <a class="right-off-canvas-toggle p10"><i class="icon-wallet size-24"></i></a>
</section> </section>
@ -77,7 +77,7 @@
<div ng-include="'views/includes/sidebar-mobile.html'"></div> <div ng-include="'views/includes/sidebar-mobile.html'"></div>
</aside> </aside>
<aside class="right-off-canvas-menu"> <aside class="right-off-canvas-menu" ng-if="$root.iden && $root.iden.listWallets().length >1">
<div ng-include="'views/includes/walletbar-mobile.html'"></div> <div ng-include="'views/includes/walletbar-mobile.html'"></div>
</aside> </aside>
<div <div

View file

@ -56,21 +56,6 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
} }
}); });
$scope.done = function() {
$rootScope.starting = false;
$rootScope.$digest();
};
$scope.$on("$destroy", function() {
var iden = $rootScope.iden;
if (iden) {
iden.removeListener('newWallet', $scope.done);
iden.removeListener('noWallets', $scope.done);
}
});
$scope.openWithPin = function(pin) { $scope.openWithPin = function(pin) {
if (!pin) { if (!pin) {
@ -92,11 +77,8 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
$scope.openWallets = function() { $scope.openWallets = function() {
preconditions.checkState($rootScope.iden); preconditions.checkState($rootScope.iden);
var iden = $rootScope.iden; var iden = $rootScope.iden;
$rootScope.hideNavigation = false; $rootScope.hideNavigation = false;
$rootScope.starting = true; $rootScope.starting = true;
iden.on('newWallet', $scope.done);
iden.on('noWallets', $scope.done);
iden.openWallets(); iden.openWallets();
}; };
@ -169,7 +151,6 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
// mobile // mobile
if ($scope.isMobile && !$rootScope.hasPin) { if ($scope.isMobile && !$rootScope.hasPin) {
$scope.done();
_credentials = { _credentials = {
email: email, email: email,
password: password, password: password,

View file

@ -31,6 +31,7 @@ angular.module('copayApp.services')
root.goWalletHome = function() { root.goWalletHome = function() {
var w = $rootScope.wallet; var w = $rootScope.wallet;
if (w) { if (w) {
$rootScope.starting = false;
if (!w.isComplete()) { if (!w.isComplete()) {
$location.path('/copayers'); $location.path('/copayers');
} else { } else {
@ -288,7 +289,6 @@ angular.module('copayApp.services')
var self = this; var self = this;
root.setupGlobalVariables(iden); root.setupGlobalVariables(iden);
iden.on('newWallet', function(wid) { iden.on('newWallet', function(wid) {
var w = iden.getWalletById(wid); var w = iden.getWalletById(wid);
copay.logger.debug('newWallet:', w.getName(), wid, iden.getLastFocusedWalletId()); copay.logger.debug('newWallet:', w.getName(), wid, iden.getLastFocusedWalletId());
@ -298,20 +298,25 @@ angular.module('copayApp.services')
root.setFocusedWallet(w, true); root.setFocusedWallet(w, true);
root.goWalletHome(); root.goWalletHome();
} }
// At the end (after all handlers are in place)...start the wallet. // At the end (after all handlers are in place)...start the wallet.
w.netStart(); w.netStart();
}); });
iden.on('noWallets', function() { iden.on('noWallets', function() {
notification.warning('No Wallets','Your profile has no wallet. Create one here');
$rootScope.starting = false;
$location.path('/create'); $location.path('/create');
$rootScope.$digest() $timeout(function() {
$rootScope.$digest();
}, 1);
}); });
iden.on('walletDeleted', function(wid) { iden.on('walletDeleted', function(wid) {
// do nothing. this is handled 'on sync' on controller. // do nothing. this is handled 'on sync' on controller.
}); });
iden.on('walletStorageError', function (wid, message) { iden.on('walletStorageError', function(wid, message) {
notification.error('Error storing wallet', message); notification.error('Error storing wallet', message);
}); });

View file

@ -111,7 +111,7 @@
</form> </form>
</div> </div>
<div ng-if='!$root.hasPin && !askForPin'> <div ng-if='!$root.hasPin && !askForPin && !$root.iden'>
<div class="clipo"> <div class="clipo">
<img src="img/clipo-signin.png" alt="clipo" width="310"> <img src="img/clipo-signin.png" alt="clipo" width="310">
</div> </div>

View file

@ -2,11 +2,6 @@
<header ng-show="$root.wallet"> <header ng-show="$root.wallet">
<h1>My wallets</h1> <h1>My wallets</h1>
</header> </header>
<div class="side-nav text-center off-canvas-list" ng-show="!wallets[0]">
<p class="size-12 text-gray m10t" translate>You do not have another wallets.</p>
<a href="#!/create" class="db button secondary tiny" title="Create new wallet">
<i class="m10r fi-plus"></i> {{'Create new wallet' | translate }} </a>
</div>
<ul class="side-nav wallets off-canvas-list" ng-show="wallets[0]"> <ul class="side-nav wallets off-canvas-list" ng-show="wallets[0]">
<li <li
ng-repeat="item in wallets track by $index" ng-repeat="item in wallets track by $index"