Browse Source

FIX: Place caching mechanism in a try catch

nonetwork
Marcos Rodriguez Vélez 6 years ago
parent
commit
697cb0f198
  1. 25
      screen/send/details.js

25
screen/send/details.js

@ -129,19 +129,20 @@ export default class SendDetails extends Component {
async componentDidMount() {
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
try {
const cachedNetworkTransactionFees = JSON.parse(await AsyncStorage.getItem(NetworkTransactionFee.StorageKey));
if (cachedNetworkTransactionFees.halfHourFee) {
this.setState({
fee: cachedNetworkTransactionFees.halfHourFee,
networkTransactionFees: cachedNetworkTransactionFees,
feeSliderValue: cachedNetworkTransactionFees.halfHourFee,
});
}
} catch (_) {}
const cachedNetworkTransactionFees = JSON.parse(await AsyncStorage.getItem(NetworkTransactionFee.StorageKey));
if (cachedNetworkTransactionFees.halfHourFee) {
this.setState({
fee: cachedNetworkTransactionFees.halfHourFee,
networkTransactionFees: cachedNetworkTransactionFees,
feeSliderValue: cachedNetworkTransactionFees.halfHourFee,
});
}
const recommendedFees = await NetworkTransactionFees.recommendedFees();
if (recommendedFees.hasOwnProperty('halfHourFee')) {
let recommendedFees = await NetworkTransactionFees.recommendedFees();
if (recommendedFees.halfHourFee) {
await AsyncStorage.setItem(NetworkTransactionFee.StorageKey, JSON.stringify(recommendedFees));
this.setState({
fee: recommendedFees.halfHourFee,

Loading…
Cancel
Save