feat: send timezone information to machine
This commit is contained in:
parent
83648b9a31
commit
7f35d34128
1 changed files with 16 additions and 6 deletions
|
|
@ -221,6 +221,7 @@ function plugins (settings, deviceId) {
|
|||
|
||||
const fiatCode = localeConfig.fiatCurrency
|
||||
const cryptoCodes = localeConfig.cryptoCurrencies
|
||||
const timezone = localeConfig.timezone.split(':')
|
||||
|
||||
const tickerPromises = cryptoCodes.map(c => ticker.getRates(settings, fiatCode, c))
|
||||
const balancePromises = cryptoCodes.map(c => fiatBalance(fiatCode, c))
|
||||
|
|
@ -228,21 +229,29 @@ function plugins (settings, deviceId) {
|
|||
const pingPromise = recordPing(deviceTime, machineVersion, machineModel)
|
||||
const currentConfigVersionPromise = fetchCurrentConfigVersion()
|
||||
const currentAvailablePromoCodes = promoCodes.getNumberOfAvailablePromoCodes()
|
||||
const timezoneObj = { utcOffset: timezone[0], dstOffset: timezone[1] }
|
||||
|
||||
const promises = [
|
||||
buildAvailableCassettes(),
|
||||
pingPromise,
|
||||
currentConfigVersionPromise
|
||||
].concat(tickerPromises, balancePromises, testnetPromises, currentAvailablePromoCodes)
|
||||
currentConfigVersionPromise,
|
||||
timezoneObj
|
||||
].concat(
|
||||
tickerPromises,
|
||||
balancePromises,
|
||||
testnetPromises,
|
||||
currentAvailablePromoCodes
|
||||
)
|
||||
|
||||
return Promise.all(promises)
|
||||
.then(arr => {
|
||||
const cassettes = arr[0]
|
||||
const configVersion = arr[2]
|
||||
const tz = arr[3]
|
||||
const cryptoCodesCount = cryptoCodes.length
|
||||
const tickers = arr.slice(3, cryptoCodesCount + 3)
|
||||
const balances = arr.slice(cryptoCodesCount + 3, 2 * cryptoCodesCount + 3)
|
||||
const testNets = arr.slice(2 * cryptoCodesCount + 3, arr.length - 1)
|
||||
const tickers = arr.slice(4, cryptoCodesCount + 4)
|
||||
const balances = arr.slice(cryptoCodesCount + 4, 2 * cryptoCodesCount + 4)
|
||||
const testNets = arr.slice(2 * cryptoCodesCount + 4, arr.length - 1)
|
||||
const coinParams = _.zip(cryptoCodes, testNets)
|
||||
const coinsWithoutRate = _.map(mapCoinSettings, coinParams)
|
||||
const areThereAvailablePromoCodes = arr[arr.length - 1] > 0
|
||||
|
|
@ -253,7 +262,8 @@ function plugins (settings, deviceId) {
|
|||
balances: buildBalances(balances),
|
||||
coins: _.zipWith(_.assign, coinsWithoutRate, tickers),
|
||||
configVersion,
|
||||
areThereAvailablePromoCodes
|
||||
areThereAvailablePromoCodes,
|
||||
timezone: tz
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue