Merge pull request #3463 from matiu/bug/import-address
refactor scan after importing a wallet
This commit is contained in:
commit
314275f986
4 changed files with 25 additions and 20 deletions
|
|
@ -170,11 +170,6 @@ angular.module('copayApp.controllers').controller('createController',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey) {
|
|
||||||
if (opts.n == 1) {
|
|
||||||
$rootScope.$emit('Local/WalletImported', walletId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -923,9 +923,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
}
|
}
|
||||||
|
|
||||||
profileService.setWalletClients();
|
profileService.setWalletClients();
|
||||||
$timeout(function() {
|
self.startScan(self.walletId);
|
||||||
$rootScope.$emit('Local/WalletImported', self.walletId);
|
|
||||||
}, 100);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1176,10 +1174,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.debouncedUpdate();
|
self.debouncedUpdate();
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/BackupDone', function(event) {
|
$rootScope.$on('Local/BackupDone', function(event, walletId) {
|
||||||
self.needsBackup = false;
|
self.needsBackup = false;
|
||||||
$log.debug('Backup done');
|
$log.debug('Backup done');
|
||||||
storageService.setBackupFlag(self.walletId, function(err) {
|
storageService.setBackupFlag(walletId || self.walletId, function(err) {
|
||||||
$log.debug('Backup done stored');
|
$log.debug('Backup done stored');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -129,11 +129,6 @@ angular.module('copayApp.controllers').controller('joinController',
|
||||||
return;
|
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);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -379,12 +379,29 @@ angular.module('copayApp.services')
|
||||||
root.profile.credentials.push(JSON.parse(walletClient.export()));
|
root.profile.credentials.push(JSON.parse(walletClient.export()));
|
||||||
root.setWalletClients();
|
root.setWalletClients();
|
||||||
|
|
||||||
|
|
||||||
|
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() {
|
root.setAndStoreFocus(walletId, function() {
|
||||||
storageService.storeProfile(root.profile, function(err) {
|
storageService.storeProfile(root.profile, function(err) {
|
||||||
return cb(err, walletId);
|
return cb(err, walletId);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
root.importWallet = function(str, opts, cb) {
|
root.importWallet = function(str, opts, cb) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue