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

fix: initialize deviceInfo before putting adKey there #56

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ protected ParselyTracker(String siteId, int flushInterval, Context c) {
this.rootUrl = "https://p1.parsely.com/";
this.queueSizeLimit = 50;
this.storageSizeLimit = 100;
this.deviceInfo = this.collectDeviceInfo();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, @wzieba!
np: I understand that collectDeviceInfo is a map containing the device information. WDYT if instead of creating this map within the post execute of the GetKey task, we keep it in the constructor and move only the get key logic to the postExecute, so the GetAdKey is only responsible for obtaining/saving the key and not for collecting the device info.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point with keeping responsibilities seperately but collectDeviceInfo uses adKey property, which is assigned in GetAdKey, so that's why I moved creation of deviceInfo to GetAdKey.

this.timer = new Timer();
this.isDebug = false;

Expand Down Expand Up @@ -757,6 +756,7 @@ protected String doInBackground(Void... params) {
@Override
protected void onPostExecute(String advertId) {
adKey = advertId;
deviceInfo = collectDeviceInfo();
deviceInfo.put("parsely_site_uuid", adKey);
}

Expand Down