Abstract bitpayCardCredentials to appIdentity. Improve alert text on card removal.
This commit is contained in:
parent
40f0901f2e
commit
43f24ee35e
5 changed files with 87 additions and 60 deletions
|
|
@ -95,7 +95,8 @@ angular.module('copayApp.services')
|
|||
// Upgraders are executed in numerical order per the '##_' object key prefix.
|
||||
//
|
||||
var _upgraders = {
|
||||
'00_bitpayDebitCards' : _upgrade_bitpayDebitCards // 2016-11: Upgrade bitpayDebitCards-x to bitpayAccounts-x
|
||||
'00_bitpayDebitCards' : _upgrade_bitpayDebitCards, // 2016-11: Upgrade bitpayDebitCards-x to bitpayAccounts-x
|
||||
'01_bitpayCardCredentials' : _upgrade_bitpayCardCredentials // 2016-11: Upgrade bitpayCardCredentials-x to appIdentity-x
|
||||
};
|
||||
|
||||
function _upgrade_bitpayDebitCards(key, network, cb) {
|
||||
|
|
@ -119,6 +120,28 @@ angular.module('copayApp.services')
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
function _upgrade_bitpayCardCredentials(key, network, cb) {
|
||||
key += '-' + network;
|
||||
storage.get(key, function(err, data) {
|
||||
if (err) return cb(err);
|
||||
if (data != null) {
|
||||
// Needs upgrade
|
||||
if (lodash.isString(data)) {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
data = data || {};
|
||||
root.setAppIdentity(network, data, function(err) {
|
||||
if (err) return cb(err);
|
||||
storage.remove(key, function() {
|
||||
cb(null, 'replaced with \'appIdentity\'');
|
||||
});
|
||||
});
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
};
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
@ -488,16 +511,16 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
root.setBitpayCardCredentials = function(network, data, cb) {
|
||||
storage.set('bitpayCardCredentials-' + network, data, cb);
|
||||
root.setAppIdentity = function(network, data, cb) {
|
||||
storage.set('appIdentity-' + network, data, cb);
|
||||
};
|
||||
|
||||
root.getBitpayCardCredentials = function(network, cb) {
|
||||
storage.get('bitpayCardCredentials-' + network, cb);
|
||||
root.getAppIdentity = function(network, cb) {
|
||||
storage.get('appIdentity-' + network, cb);
|
||||
};
|
||||
|
||||
root.removeBitpayCardCredentials = function(network, cb) {
|
||||
storage.remove('bitpayCardCredentials-' + network, cb);
|
||||
root.removeAppIdentity = function(network, cb) {
|
||||
storage.remove('appIdentity-' + network, cb);
|
||||
};
|
||||
|
||||
root.removeAllWalletData = function(walletId, cb) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue