creates a wallet address by default for all non multisig wallets
This commit is contained in:
parent
1788dec4fc
commit
f8135f3bd3
2 changed files with 69 additions and 32 deletions
|
|
@ -235,36 +235,48 @@ angular.module('copayApp.controllers').controller('createController',
|
||||||
ongoingProcess.set('creatingWallet', true);
|
ongoingProcess.set('creatingWallet', true);
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
profileService.createWallet(opts, function(err, client) {
|
profileService.createWallet(opts, function(err, client) {
|
||||||
ongoingProcess.set('creatingWallet', false);
|
function finish(error) {
|
||||||
if (err) {
|
ongoingProcess.set('creatingWallet', false);
|
||||||
$log.warn(err);
|
if (error) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
$log.warn(error);
|
||||||
return;
|
popupService.showAlert(gettextCatalog.getString('Error'), error);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
walletService.updateRemotePreferences(client);
|
walletService.updateRemotePreferences(client);
|
||||||
pushNotificationsService.updateSubscription(client);
|
pushNotificationsService.updateSubscription(client);
|
||||||
|
|
||||||
if ($scope.formData.seedSource.id == 'set') {
|
if ($scope.formData.seedSource.id == 'set') {
|
||||||
profileService.setBackupFlag(client.credentials.walletId);
|
profileService.setBackupFlag(client.credentials.walletId);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ionicHistory.removeBackView();
|
$ionicHistory.removeBackView();
|
||||||
|
|
||||||
if (!client.isComplete()) {
|
if (!client.isComplete()) {
|
||||||
$ionicHistory.nextViewOptions({
|
$ionicHistory.nextViewOptions({
|
||||||
disableAnimate: true
|
disableAnimate: true
|
||||||
});
|
|
||||||
$state.go('tabs.home');
|
|
||||||
$timeout(function() {
|
|
||||||
$state.transitionTo('tabs.copayers', {
|
|
||||||
walletId: client.credentials.walletId
|
|
||||||
});
|
});
|
||||||
}, 100);
|
$state.go('tabs.home');
|
||||||
|
$timeout(function() {
|
||||||
|
$state.transitionTo('tabs.copayers', {
|
||||||
|
walletId: client.credentials.walletId
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
firebaseEventsService.logEvent('wallet_created', { coin: opts.coin });
|
||||||
|
$state.go('tabs.home');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
firebaseEventsService.logEvent('wallet_created', { coin: opts.coin });
|
if (opts.n >= 2) {
|
||||||
$state.go('tabs.home');
|
finish(err);
|
||||||
|
} else {
|
||||||
|
ongoingProcess.set('generatingNewAddress', true);
|
||||||
|
walletService.getAddress(client, true, function(e, addr) {
|
||||||
|
ongoingProcess.set('generatingNewAddress', false);
|
||||||
|
finish(e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('copayApp.controllers').controller('tourController',
|
angular.module('copayApp.controllers').controller('tourController',
|
||||||
function($scope, $state, $log, $timeout, $filter, ongoingProcess, profileService, rateService, popupService, gettextCatalog, startupService, storageService) {
|
function($scope, $state, $log, $timeout, $filter, ongoingProcess, profileService, rateService, popupService, gettextCatalog, startupService, storageService, walletService, $q) {
|
||||||
|
|
||||||
$scope.data = {
|
$scope.data = {
|
||||||
index: 0
|
index: 0
|
||||||
|
|
@ -60,16 +60,41 @@ angular.module('copayApp.controllers').controller('tourController',
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
ongoingProcess.set('creatingWallet', false);
|
ongoingProcess.set('creatingWallet', false);
|
||||||
var bchWallet = walletClients[0];
|
var bchWallet = walletClients[0];
|
||||||
var btcWallet = walletClients[1];
|
var btcWallet = walletClients[1];
|
||||||
|
|
||||||
var bchWalletId = bchWallet.credentials.walletId;
|
var bchWalletId = bchWallet.credentials.walletId;
|
||||||
var btcWalletId = btcWallet.credentials.walletId;
|
var btcWalletId = btcWallet.credentials.walletId;
|
||||||
|
|
||||||
$state.go('onboarding.collectEmail', {
|
function createAddressPromise(wallet) {
|
||||||
bchWalletId: bchWalletId,
|
return $q(function(resolve, reject) {
|
||||||
btcWalletId: btcWalletId
|
walletService.getAddress(wallet, true, function(e, addr) {
|
||||||
|
if (e) reject(e);
|
||||||
|
resolve(addr);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function goToCollectEmail() {
|
||||||
|
$state.go('onboarding.collectEmail', {
|
||||||
|
bchWalletId: bchWalletId,
|
||||||
|
btcWalletId: btcWalletId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var bchAddressPromise = createAddressPromise(bchWallet);
|
||||||
|
var btcAddressPromise = createAddressPromise(btcWallet);
|
||||||
|
ongoingProcess.set('generatingNewAddress', true);
|
||||||
|
|
||||||
|
$q.all([bchAddressPromise, btcAddressPromise]).then(function(addresses) {
|
||||||
|
ongoingProcess.set('generatingNewAddress', false);
|
||||||
|
goToCollectEmail();
|
||||||
|
}, function(e) {
|
||||||
|
ongoingProcess.set('generatingNewAddress', false);
|
||||||
|
$log.warn(e);
|
||||||
|
popupService.showAlert(gettextCatalog.getString('Error'), e);
|
||||||
|
goToCollectEmail();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue