-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send correct install referrer timestamps (close #687) #690
Conversation
1d0452a
to
2ca4b89
Compare
@@ -44,6 +44,9 @@ object Util { | |||
return System.currentTimeMillis().toString() | |||
} | |||
|
|||
/** | |||
* Converts a timestamp in milliseconds to a DateTime. | |||
*/ | |||
@JvmStatic | |||
fun getDateTimeFromTimestamp(timestamp: Long): String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a validation in this function that the timestamp
is in fact milliseconds
? To ensure this issue doesn't happen again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is used in two places, the InstallReferrer thing and in Session. So it's called with every event that's tracked. I'd rather not add a validation for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
"referrerClickTimestamp" to if (referrerClickTimestamp > 0) { Util.getDateTimeFromTimestamp(referrerClickTimestamp) } else { null }, | ||
"installBeginTimestamp" to if (installBeginTimestamp > 0) { Util.getDateTimeFromTimestamp(installBeginTimestamp) } else { null }, | ||
"referrerClickTimestamp" to if (referrerClickTimestamp > 0) { Util.getDateTimeFromTimestamp(referrerClickTimestamp * 1000) } else { null }, | ||
"installBeginTimestamp" to if (installBeginTimestamp > 0) { Util.getDateTimeFromTimestamp(installBeginTimestamp * 1000) } else { null }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any unit tests available to ratify this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have any unit tests for this class. The InstallReferrer library isn't available in the tests, so the install_referrer
entity doesn't get added in the ApplicationInstallEvent
test either
For issue #687
The Android InstallReferrer library returns timestamps in seconds, but the tracker expects milliseconds. This change fixes it so that the correct timestamp strings are sent.
NB: the CI tests for API 30 are currently failing due to flakiness. This is a known problem and will be addressed in a future PR.