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);
|
||||
$timeout(function() {
|
||||
profileService.createWallet(opts, function(err, client) {
|
||||
ongoingProcess.set('creatingWallet', false);
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
function finish(error) {
|
||||
ongoingProcess.set('creatingWallet', false);
|
||||
if (error) {
|
||||
$log.warn(error);
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), error);
|
||||
return;
|
||||
}
|
||||
|
||||
walletService.updateRemotePreferences(client);
|
||||
pushNotificationsService.updateSubscription(client);
|
||||
walletService.updateRemotePreferences(client);
|
||||
pushNotificationsService.updateSubscription(client);
|
||||
|
||||
if ($scope.formData.seedSource.id == 'set') {
|
||||
profileService.setBackupFlag(client.credentials.walletId);
|
||||
}
|
||||
if ($scope.formData.seedSource.id == 'set') {
|
||||
profileService.setBackupFlag(client.credentials.walletId);
|
||||
}
|
||||
|
||||
$ionicHistory.removeBackView();
|
||||
$ionicHistory.removeBackView();
|
||||
|
||||
if (!client.isComplete()) {
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true
|
||||
});
|
||||
$state.go('tabs.home');
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.copayers', {
|
||||
walletId: client.credentials.walletId
|
||||
if (!client.isComplete()) {
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true
|
||||
});
|
||||
}, 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 });
|
||||
$state.go('tabs.home');
|
||||
|
||||
if (opts.n >= 2) {
|
||||
finish(err);
|
||||
} else {
|
||||
ongoingProcess.set('generatingNewAddress', true);
|
||||
walletService.getAddress(client, true, function(e, addr) {
|
||||
ongoingProcess.set('generatingNewAddress', false);
|
||||
finish(e);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 300);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
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 = {
|
||||
index: 0
|
||||
|
|
@ -60,16 +60,41 @@ angular.module('copayApp.controllers').controller('tourController',
|
|||
}
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
ongoingProcess.set('creatingWallet', false);
|
||||
var bchWallet = walletClients[0];
|
||||
var btcWallet = walletClients[1];
|
||||
|
||||
var bchWalletId = bchWallet.credentials.walletId;
|
||||
var btcWalletId = btcWallet.credentials.walletId;
|
||||
|
||||
$state.go('onboarding.collectEmail', {
|
||||
bchWalletId: bchWalletId,
|
||||
btcWalletId: btcWalletId
|
||||
function createAddressPromise(wallet) {
|
||||
return $q(function(resolve, reject) {
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue