mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add date access throughout the data flow.
This commit is contained in:
parent
66941f0808
commit
716e65424d
@ -288,7 +288,7 @@ ConfigManager.prototype.setConversionRate = function () {
|
|||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
const parsedResponse = JSON.parse(response)
|
const parsedResponse = JSON.parse(response)
|
||||||
data.conversionRate = Number(parsedResponse.ticker.price)
|
data.conversionRate = Number(parsedResponse.ticker.price)
|
||||||
data.conversionLastUpdated = new Date(parsedResponse.timestamp).toString()
|
data.conversionDate = new Date(parsedResponse.timestamp).toString()
|
||||||
this.setData(data)
|
this.setData(data)
|
||||||
}.bind(this)).catch(function (err) {
|
}.bind(this)).catch(function (err) {
|
||||||
console.log('Error in conversion.', err)
|
console.log('Error in conversion.', err)
|
||||||
@ -300,7 +300,7 @@ ConfigManager.prototype.getConversionRate = function () {
|
|||||||
return ('conversionRate' in data) && data.conversionRate
|
return ('conversionRate' in data) && data.conversionRate
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigManager.prototype.getConversionLastUpdated = function () {
|
ConfigManager.prototype.getConversionDate = function () {
|
||||||
var data = this.getData()
|
var data = this.getData()
|
||||||
return ('conversionLastUpdated' in data) && data.conversionLastUpdated
|
return ('conversionDate' in data) && data.conversionDate
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,8 @@ IdentityStore.prototype.getState = function () {
|
|||||||
messages: messageManager.getMsgList(),
|
messages: messageManager.getMsgList(),
|
||||||
selectedAddress: configManager.getSelectedAccount(),
|
selectedAddress: configManager.getSelectedAccount(),
|
||||||
currentFiat: configManager.getCurrentFiat(),
|
currentFiat: configManager.getCurrentFiat(),
|
||||||
currentConversion: configManager.getConversionRate(),
|
conversionRate: configManager.getConversionRate(),
|
||||||
|
conversionDate: configManager.getConversionDate(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,6 +245,7 @@ module.exports = class MetamaskController {
|
|||||||
const data = {
|
const data = {
|
||||||
conversionRate: this.configManager.getConversionRate,
|
conversionRate: this.configManager.getConversionRate,
|
||||||
currentFiat: this.configManager.getCurrentFiat,
|
currentFiat: this.configManager.getCurrentFiat,
|
||||||
|
conversionDate: this.configManager.getConversionDate,
|
||||||
}
|
}
|
||||||
cb(data)
|
cb(data)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -219,6 +219,7 @@ function setCurrentFiat (fiat) {
|
|||||||
value: {
|
value: {
|
||||||
currentFiat: data.currentFiat,
|
currentFiat: data.currentFiat,
|
||||||
conversionRate: data.conversionRate,
|
conversionRate: data.conversionRate,
|
||||||
|
conversionDate: data.conversionDate,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -113,6 +113,7 @@ function reduceMetamask (state, action) {
|
|||||||
return extend(metaMaskState, {
|
return extend(metaMaskState, {
|
||||||
currentFiat: action.value.currentFiat,
|
currentFiat: action.value.currentFiat,
|
||||||
conversionRate: action.value.conversionRate,
|
conversionRate: action.value.conversionRate,
|
||||||
|
conversionDate: action.value.conversionDate,
|
||||||
})
|
})
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user