always support bitcoin cash, added bwscash default url, converts tarascash wallets

This commit is contained in:
Kadir Sekha 2017-10-26 16:03:15 +09:00
commit 221f8bdd8e

View file

@ -14,7 +14,11 @@ angular.module('copayApp.services').factory('configService', function(storageSer
// Bitcore wallet service URL // Bitcore wallet service URL
bws: { bws: {
url: 'https://bws.bitcoin.com/bws/api', url: 'https://bws.bitcoin.com/bws/api'
},
bwscash: {
url: 'https://bwscash.bitcoin.com/bws/api'
}, },
download: { download: {
@ -69,7 +73,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer
bannedUntil: null, bannedUntil: null,
}, },
cashSupport: false, cashSupport: true,
recentTransactions: { recentTransactions: {
enabled: true, enabled: true,
@ -107,7 +111,6 @@ angular.module('copayApp.services').factory('configService', function(storageSer
root.getSync = function() { root.getSync = function() {
if (!configCache) if (!configCache)
throw new Error('configService#getSync called when cache is not initialized'); throw new Error('configService#getSync called when cache is not initialized');
return configCache; return configCache;
}; };
@ -122,7 +125,6 @@ angular.module('copayApp.services').factory('configService', function(storageSer
root.get = function(cb) { root.get = function(cb) {
storageService.getConfig(function(err, localConfig) { storageService.getConfig(function(err, localConfig) {
if (localConfig) { if (localConfig) {
configCache = JSON.parse(localConfig); configCache = JSON.parse(localConfig);
@ -142,10 +144,8 @@ angular.module('copayApp.services').factory('configService', function(storageSer
configCache.hideNextSteps = defaultConfig.hideNextSteps; configCache.hideNextSteps = defaultConfig.hideNextSteps;
} }
// Always support Bitcoin Cash
if (!configCache.cashSupport) { configCache.cashSupport = true;
configCache.cashSupport = defaultConfig.cashSupport;
}
if (!configCache.recentTransactions) { if (!configCache.recentTransactions) {
configCache.recentTransactions = defaultConfig.recentTransactions; configCache.recentTransactions = defaultConfig.recentTransactions;
@ -165,6 +165,19 @@ angular.module('copayApp.services').factory('configService', function(storageSer
configCache.wallet.settings.unitCode = defaultConfig.wallet.settings.unitCode; configCache.wallet.settings.unitCode = defaultConfig.wallet.settings.unitCode;
} }
// Convert tarascash wallet to new style cash wallet
if (configCache.bwsbcc && configCache.bwsbcc.url && configCache.bwsbcc.url.indexOf('bwsbcc') >= 0) {
configCache.bwsbcc = defaultConfig.bwscash.url;
}
if (configCache.bwsFor) {
for (var key in configCache.bwsFor) {
if (configCache.bwsFor[key].indexOf('bwsbcc') >= 0) {
configCache.bwsFor[key] = defaultConfig.bwscash.url;
}
}
}
} else { } else {
configCache = lodash.clone(defaultConfig); configCache = lodash.clone(defaultConfig);
}; };