fix create and join bws errors
This commit is contained in:
parent
808c7f74a5
commit
3d7132861d
7 changed files with 73 additions and 82 deletions
|
|
@ -56,6 +56,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
name: form.walletName.$modelValue,
|
||||
myName: $scope.totalCopayers > 1 ? form.myName.$modelValue : null,
|
||||
networkName: form.isTestnet.$modelValue ? 'testnet' : 'livenet',
|
||||
bwsurl: $scope.bwsurl
|
||||
};
|
||||
var setSeed = form.setSeed.$modelValue;
|
||||
if (setSeed) {
|
||||
|
|
@ -111,15 +112,6 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
return;
|
||||
}
|
||||
|
||||
var opts_ = {
|
||||
bws: {}
|
||||
};
|
||||
opts_.bws[walletId] = $scope.bwsurl;
|
||||
configService.set(opts_, function(err) {
|
||||
if (err) console.log(err);
|
||||
go.walletHome();
|
||||
});
|
||||
|
||||
if (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey) {
|
||||
if (opts.n == 1) {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
bws: {}
|
||||
};
|
||||
opts.bws[walletId] = $scope.bwsurl;
|
||||
configService.set(opts, function(err) {
|
||||
if (err) return cb(err);
|
||||
return cb(null);
|
||||
});
|
||||
configService.set(opts, cb);
|
||||
}
|
||||
|
||||
var _importBlob = function(str, opts) {
|
||||
|
|
@ -56,7 +53,8 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$timeout(function() {
|
||||
profileService.importWallet(str2, {
|
||||
compressed: null,
|
||||
password: null
|
||||
password: null,
|
||||
bwsurl: $scope.bwsurl
|
||||
}, function(err, walletId) {
|
||||
self.loading = false;
|
||||
if (err) {
|
||||
|
|
@ -64,7 +62,6 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
} else {
|
||||
setBwsURL(walletId, function() {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
go.walletHome();
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
});
|
||||
}
|
||||
|
|
@ -88,7 +85,6 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
setBwsURL(walletId, function() {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
|
|
@ -109,7 +105,6 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
setBwsURL(walletId, function() {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
|
|
@ -264,7 +259,6 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
setBwsURL(walletId, function() {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
|
|
|
|||
|
|
@ -1129,18 +1129,15 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.setFocusedWallet();
|
||||
self.updateTxHistory();
|
||||
go.walletHome();
|
||||
storageService.getCleanAndScanAddresses(function(err, val) {
|
||||
if (val) {
|
||||
$log.debug('Clear last address cache and Scan');
|
||||
lodash.each(lodash.keys(profileService.walletClients), function(walletId) {
|
||||
addressService.expireAddress(walletId, function(err) {
|
||||
self.startScan(walletId);
|
||||
});
|
||||
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
||||
if (walletId && profileService.walletClients[walletId]) {
|
||||
$log.debug('Clear last address cache and Scan ', walletId);
|
||||
addressService.expireAddress(walletId, function(err) {
|
||||
self.startScan(walletId);
|
||||
});
|
||||
storageService.removeCleanAndScanAddresses(function() {});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/SetTab', function(event, tab, reset) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('joinController',
|
||||
function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, $modal, gettext, lodash, ledger, trezor) {
|
||||
function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, storageService, applicationService, $modal, gettext, lodash, ledger, trezor) {
|
||||
|
||||
var self = this;
|
||||
var defaults = configService.getDefaults();
|
||||
var defaults = configService.getDefaults();
|
||||
$scope.bwsurl = defaults.bws.url;
|
||||
|
||||
this.onQrCodeScanned = function(data) {
|
||||
|
|
@ -24,6 +23,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
var opts = {
|
||||
secret: form.secret.$modelValue,
|
||||
myName: form.myName.$modelValue,
|
||||
bwsurl: $scope.bwsurl
|
||||
}
|
||||
|
||||
var setSeed = form.setSeed.$modelValue;
|
||||
|
|
@ -71,25 +71,13 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
self.loading = false;
|
||||
self.error = err;
|
||||
$rootScope.$apply();
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
$timeout(function() {
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
var opts_ = {
|
||||
bws: {}
|
||||
};
|
||||
|
||||
opts_.bws[fc.credentials.walletId] = $scope.bwsurl;
|
||||
configService.set(opts_, function(err) {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
|
||||
if (fc.isComplete() && (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey)) {
|
||||
if (fc.isComplete() && (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey))
|
||||
$rootScope.$emit('Local/WalletImported', fc.credentials.walletId);
|
||||
} else {
|
||||
go.walletHome();
|
||||
}
|
||||
}, 2000);
|
||||
});
|
||||
}, 100);
|
||||
|
|
|
|||
|
|
@ -35,16 +35,16 @@ angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
|
|||
this.bwsurl = bws;
|
||||
}
|
||||
|
||||
var opts = {
|
||||
bws: {}
|
||||
};
|
||||
opts.bws[walletId] = this.bwsurl;
|
||||
var opts = {
|
||||
bws: {}
|
||||
};
|
||||
opts.bws[walletId] = this.bwsurl;
|
||||
|
||||
configService.set(opts, function(err) {
|
||||
if (err) console.log(err);
|
||||
storageService.setCleanAndScanAddresses(function() {
|
||||
applicationService.restart();
|
||||
configService.set(opts, function(err) {
|
||||
if (err) console.log(err);
|
||||
storageService.setCleanAndScanAddresses(walletId, function() {
|
||||
applicationService.restart();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue