Closed giautm closed 4 years ago
@giautm thanks for submitting this! Are there any side effects of this change? It seems unlikely, but what I would notice is that in the original version, the parameters
object is updated before every call to the GA API, so if the screen resolution changes, or any of the additionalParameters change, the original parameters
property would be stale.
Perhaps a better implementation of this would be to set it in the constructor, as you currently have it, but then update it as it was doing before inside the promiseGetWebViewUserAgentAsync
promise?
@ryanvanderpol : with current implement of promiseGetWebViewUserAgentAsync
, It just return the old promise with resolved value, no re-calculate step/update parameters
. So the parameters object is updated before every call to the GA API
was wrong.
If you want that effect, return a function then call it before every call to GA.
try this test in console,
var a = Promise.resolve(1).then(e => {
console.log('Called',e);
return e + 1;
})
a.then(console.log)
a.then(console.log)
@giautm @delanebob this has now been merged in and published to NPM. please let me know if you experience any adverse effects from this, and thank you for your help!
Fix issue: https://github.com/ryanvanderpol/expo-analytics/issues/58