fix and enhance create / join / import forms for hardware wallets

This commit is contained in:
Matias Alejo Garcia 2015-09-29 12:45:06 -03:00
commit f2deba10ec
9 changed files with 178 additions and 81 deletions

View file

@ -1,14 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, go, isMobile, notification, profileService, isCordova, isChromeApp, $modal, gettext, lodash, ledger) {
function($scope, $rootScope, $timeout, go, notification, profileService, isCordova, $modal, gettext, lodash, ledger, trezor) {
var self = this;
this.isChromeApp = function() {
return isChromeApp;
};
this.onQrCodeScanned = function(data) {
$scope.secret = data;
$scope.joinForm.secret.$setViewValue(data);
@ -45,11 +41,13 @@ angular.module('copayApp.controllers').controller('joinController',
return;
}
if (form.hwLedger.$modelValue) {
self.ledger = true;
// TODO account / network
ledger.getInfoForNewWallet(0, opts.networkName, function(err, lopts) {
self.ledger = false;
if (form.hwLedger.$modelValue || form.hwTrezor.$modelValue) {
self.hwWallet = form.hwLedger.$modelValue ? 'Leger' : 'TREZOR';
var src= form.hwLedger.$modelValue ? leger : trezor;
var account = 0;
src.getInfoForNewWallet(account, function(err, lopts) {
self.hwWallet = false;
if (err) {
self.error = err;
$scope.$apply();