This commit is contained in:
Matias Alejo Garcia 2015-04-23 15:19:30 -03:00
commit 1515b9446f
4 changed files with 41 additions and 25 deletions

View file

@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
var self = this;
self.isCordova = isCordova;
self.onGoingProcess = {};
self.limitHistory = 5;
self.limitHistory = 5;
function strip(number) {
return (parseFloat(number.toPrecision(12)));
@ -27,7 +27,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
'title': 'History',
'icon': 'icon-history',
'link': 'history'
}];
}];
self.tab = 'walletHome';
@ -104,18 +104,22 @@ angular.module('copayApp.controllers').controller('indexController', function($r
};
self.setTab = function(tab) {
document.getElementById(self.tab).className='tab-out tab-view ' + self.tab;
document.getElementById(tab).className='tab-in tab-view ' + tab;
if (self.tab && document.getElementById(self.tab)) {
document.getElementById(self.tab).className = 'tab-out tab-view ' + self.tab;
var old = document.getElementById('menu-' + self.tab);
old.className = '';
old.style.borderTopColor = '';
}
var old =document.getElementById('menu-'+self.tab);
old.className='';
old.style.borderTopColor = '';
var newe = document.getElementById('menu-'+tab);
newe.className='active';
newe.style.borderTopColor = self.backgroundColor;
if (document.getElementById(tab)) {
document.getElementById(tab).className = 'tab-in tab-view ' + tab;
var newe = document.getElementById('menu-' + tab);
newe.className = 'active';
newe.style.borderTopColor = self.backgroundColor;
}
self.tab = tab;
$rootScope.$emit('Local/TabChanged', tab);
};
self.updateAll = function(walletStatus) {
@ -472,8 +476,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
gettextCatalog.setCurrentLanguage(userLang);
amMoment.changeLocale(userLang);
}
}
else {
} else {
configService.set({
wallet: {
settings: {
@ -486,7 +489,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
}
self.defaultLanguageIsoCode = setLang || userLang;
self.defaultLanguageName = lodash.result(lodash.find(self.availableLanguages, { 'isoCode': self.defaultLanguageIsoCode }), 'name');
self.defaultLanguageName = lodash.result(lodash.find(self.availableLanguages, {
'isoCode': self.defaultLanguageIsoCode
}), 'name');
};
// UX event handlers
@ -629,8 +634,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setTab(tab);
});
$rootScope.$on('Local/NeedsPassword', function(event, isSetup, cb) {
self.askPassword = {
isSetup: isSetup,

View file

@ -21,7 +21,7 @@ angular.module('copayApp.controllers').controller('topbarController', function($
}, 100);
alert('Scanning error');
});
$scope.$emit('Local/SetTab', 'send');
go.send();
};
var modalOpenScanner = function() {
@ -79,7 +79,7 @@ angular.module('copayApp.controllers').controller('topbarController', function($
$scope.init = function() {
setScanner();
$timeout(function() {
$scope.$emit('Local/SetTab', 'send');
go.send();
canvas = document.getElementById('qr-canvas');
context = canvas.getContext('2d');

View file

@ -40,10 +40,23 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.getAddress();
});
var disableTabListener = $rootScope.$on('Local/TabChanged', function(e,tab){
switch(tab) {
case 'send':
self.resetError();
self.setInputs();
case 'receive':
self.getAddress();
break;
};
});
$scope.$on('$destroy', function() {
disableAddrListener();
disableScannerListener();
disablePaymentUriListener();
disableTabListener();
$rootScope.hideMenuBar = false;
});
@ -765,11 +778,4 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
return actions.hasOwnProperty('create');
};
// ToDo a send...
this.resetError();
this.setInputs();
// Todo Receive
this.getAddress();
});

View file

@ -52,9 +52,16 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope,
root.path('copayers');
} else {
root.path('walletHome');
$rootScope.$emit('Local/SetTab', 'walletHome');
}
};
root.send = function() {
root.path('walletHome');
$rootScope.$emit('Local/SetTab', 'walletHome');
};
root.home = function() {
if ($rootScope.iden)
root.walletHome();