Merge pull request #4409 from JDonadio/fix/double-scan

Remove handle imported client method
This commit is contained in:
Matias Alejo Garcia 2016-06-15 13:23:17 -03:00 committed by GitHub
commit 66506a9f8d
2 changed files with 18 additions and 34 deletions

View file

@ -290,7 +290,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
} else { } else {
self.isSingleAddress = !!ret.wallet.singleAddress; self.isSingleAddress = !!ret.wallet.singleAddress;
if (!opts.quiet) if (!opts.quiet)
self.updating = ret.wallet.scanStatus == 'running'; self.updating = ret.wallet.scanStatus == 'running';
} }
return cb(err, ret); return cb(err, ret);
}); });
@ -1032,7 +1032,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
}; };
self.initGlidera = function(accessToken) { self.initGlidera = function(accessToken) {
self.glideraEnabled = configService.getSync().glidera.enabled; self.glideraEnabled = configService.getSync().glidera.enabled;
self.glideraTestnet = configService.getSync().glidera.testnet; self.glideraTestnet = configService.getSync().glidera.testnet;

View file

@ -176,7 +176,8 @@ angular.module('copayApp.services')
function bindWallets(cb) { function bindWallets(cb) {
var l = root.profile.credentials.length; var l = root.profile.credentials.length;
var i = 0, totalBound = 0; var i = 0,
totalBound = 0;
if (!l) return cb(); if (!l) return cb();
@ -387,8 +388,8 @@ angular.module('copayApp.services')
// check if exist // check if exist
if (lodash.find(root.profile.credentials, { if (lodash.find(root.profile.credentials, {
'walletId': walletData.walletId 'walletId': walletData.walletId
})) { })) {
return cb(gettext('Cannot join the same wallet more that once')); return cb(gettext('Cannot join the same wallet more that once'));
} }
} catch (ex) { } catch (ex) {
@ -502,32 +503,20 @@ angular.module('copayApp.services')
}); });
}; };
var handleImportedClient = function(cb) {
if (!opts.isImport) return cb();
$rootScope.$emit('Local/BackupDone', walletId);
if (!client.isComplete())
return cb();
storageService.setCleanAndScanAddresses(walletId, cb);
};
walletService.updateRemotePreferences(client, {}, function() { walletService.updateRemotePreferences(client, {}, function() {
$log.debug('Remote preferences saved for:' + walletId) $log.debug('Remote preferences saved for:' + walletId)
}); });
saveBwsUrl(function() { saveBwsUrl(function() {
handleImportedClient(function() { root.setAndStoreFocus(walletId, function() {
root.setAndStoreFocus(walletId, function() { storageService.storeProfile(root.profile, function(err) {
storageService.storeProfile(root.profile, function(err) {
var config = configService.getSync();
if (config.pushNotifications.enabled)
pushNotificationsService.enableNotifications(root.walletClients);
return cb(err, walletId);
});
var config = configService.getSync();
if (config.pushNotifications.enabled)
pushNotificationsService.enableNotifications(root.walletClients);
return cb(err, walletId);
}); });
}); });
}); });
}; };
@ -563,8 +552,7 @@ angular.module('copayApp.services')
var historyCache = str.historyCache ||  []; var historyCache = str.historyCache ||  [];
root.addAndBindWalletClient(walletClient, { root.addAndBindWalletClient(walletClient, {
bwsurl: opts.bwsurl, bwsurl: opts.bwsurl
isImport: true
}, function(err, walletId) { }, function(err, walletId) {
if (err) return cb(err); if (err) return cb(err);
root.setMetaData(walletClient, addressBook, historyCache, function(error) { root.setMetaData(walletClient, addressBook, historyCache, function(error) {
@ -587,8 +575,7 @@ angular.module('copayApp.services')
} }
root.addAndBindWalletClient(walletClient, { root.addAndBindWalletClient(walletClient, {
bwsurl: opts.bwsurl, bwsurl: opts.bwsurl
isImport: true
}, cb); }, cb);
}); });
}; };
@ -619,8 +606,7 @@ angular.module('copayApp.services')
} }
root.addAndBindWalletClient(walletClient, { root.addAndBindWalletClient(walletClient, {
bwsurl: opts.bwsurl, bwsurl: opts.bwsurl
isImport: true
}, cb); }, cb);
}); });
}; };
@ -643,8 +629,7 @@ angular.module('copayApp.services')
} }
root.addAndBindWalletClient(walletClient, { root.addAndBindWalletClient(walletClient, {
bwsurl: opts.bwsurl, bwsurl: opts.bwsurl
isImport: true
}, cb); }, cb);
}); });
}; };