mirror of https://github.com/BTCPrivate/copay.git
refactor scan after importing a wallet
This commit is contained in:
parent
e9e8c6a0cb
commit
8c18995ae0
|
@ -170,11 +170,6 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
return;
|
||||
}
|
||||
|
||||
if (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey) {
|
||||
if (opts.n == 1) {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
|
|
@ -923,9 +923,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
}
|
||||
|
||||
profileService.setWalletClients();
|
||||
$timeout(function() {
|
||||
$rootScope.$emit('Local/WalletImported', self.walletId);
|
||||
}, 100);
|
||||
self.startScan(self.walletId);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1176,10 +1174,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.debouncedUpdate();
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/BackupDone', function(event) {
|
||||
$rootScope.$on('Local/BackupDone', function(event, walletId) {
|
||||
self.needsBackup = false;
|
||||
$log.debug('Backup done');
|
||||
storageService.setBackupFlag(self.walletId, function(err) {
|
||||
storageService.setBackupFlag(walletId || self.walletId, function(err) {
|
||||
$log.debug('Backup done stored');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -129,11 +129,6 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
return;
|
||||
}
|
||||
|
||||
$timeout(function() {
|
||||
var fc = profileService.focusedClient;
|
||||
if (fc.isComplete() && (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey))
|
||||
$rootScope.$emit('Local/WalletImported', fc.credentials.walletId);
|
||||
}, 2000);
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
|
|
@ -276,8 +276,8 @@ angular.module('copayApp.services')
|
|||
|
||||
// check if exist
|
||||
if (lodash.find(root.profile.credentials, {
|
||||
'walletId': walletData.walletId
|
||||
})) {
|
||||
'walletId': walletData.walletId
|
||||
})) {
|
||||
return cb(gettext('Cannot join the same wallet more that once'));
|
||||
}
|
||||
} catch (ex) {
|
||||
|
@ -379,9 +379,26 @@ angular.module('copayApp.services')
|
|||
root.profile.credentials.push(JSON.parse(walletClient.export()));
|
||||
root.setWalletClients();
|
||||
|
||||
root.setAndStoreFocus(walletId, function() {
|
||||
storageService.storeProfile(root.profile, function(err) {
|
||||
return cb(err, walletId);
|
||||
|
||||
var handleImport = function(cb) {
|
||||
var isImport = opts.mnemonic || opts.externalSource || opts.extendedPrivateKey;
|
||||
|
||||
if (!isImport)
|
||||
return cb();
|
||||
|
||||
$rootScope.$emit('Local/BackupDone', walletId);
|
||||
|
||||
if (!walletClient.isComplete())
|
||||
return cb();
|
||||
|
||||
storageService.setCleanAndScanAddresses(walletId, cb);
|
||||
};
|
||||
|
||||
handleImport(function() {
|
||||
root.setAndStoreFocus(walletId, function() {
|
||||
storageService.storeProfile(root.profile, function(err) {
|
||||
return cb(err, walletId);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue