Skip to content
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

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

mscwilson
Copy link
Contributor

@mscwilson mscwilson commented May 30, 2024

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.

@mscwilson mscwilson requested a review from a team May 30, 2024 16:30
@mscwilson mscwilson force-pushed the bug/687-installreferrer_timestamps branch from 1d0452a to 2ca4b89 Compare May 30, 2024 16:33
@@ -44,6 +44,9 @@ object Util {
return System.currentTimeMillis().toString()
}

/**
* Converts a timestamp in milliseconds to a DateTime.
*/
@JvmStatic
fun getDateTimeFromTimestamp(timestamp: Long): String {
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link

@agnessnowplow agnessnowplow left a 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 },
Copy link
Member

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?

Copy link
Contributor Author

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

@mscwilson mscwilson merged commit 7eda874 into release/6.0.4 Jun 4, 2024
2 of 3 checks passed
@mscwilson mscwilson deleted the bug/687-installreferrer_timestamps branch June 4, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants