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

Add optional pageType parameter to ParselyMetadata class in Android SDK #102

Closed

Conversation

MartinAkram
Copy link
Member

@MartinAkram MartinAkram commented Jan 17, 2024

⁉️ What ⁉️

This PR adds a new optional parameter, pageType, to the ParselyMetadata class in the Android SDK. This is being done in response to a client question/request (see linked issue below).

Companion iOS SDK PR: Parsely/AnalyticsSDK-iOS#90

✔️ TODOs ✔️

  • Attend Chris' office hours to figure out how to test this change
  • Get an understanding of how our Android SDK releases are handled before getting this PR merged

@wzieba
Copy link
Collaborator

wzieba commented Jan 17, 2024

hi @MartinAkram ! Thanks for preparing the PR 👍

Presently, the main branch is under a set of changes (internal: pd3OIC-1tL-p2) and getting ready for a new major release. But I think this PR should not wait for the next major release, but rather land in 3.2.0 (current release is 3.1.1).

I've just prepared release/3.2.0 branch for you. It'd be great if you could rebase on it, instead of the main. Unfortunately It'll affect the code in the PR highly - e.g. ParselyMetadata is written in Java there. Sorry for that!

@MartinAkram
Copy link
Member Author

Absolutely will do, @wzieba! Thanks so much

wzieba added 27 commits January 17, 2024 14:36
To improve readability and reduce boilerplate.
They don't provide any new data (not covered lines are still visible on
Codecov portal) but they shadow diff change of the whole PR, making it
more difficult to read.
Just above we clear `eventQueue` and purge locally stored events. There's no need to check the size of the queues.
This way, we don't have to check for nullability of the tracker. Also using `ParselyAPIConnection` without first initialising `ParselyTracker` doesn't seem to make any use case, so I think it's a save change.
BREAKING CHANGE: `ParselyAPIConnection` is no longer accessible for library consumers.

This is a deliberate design change. The `ParselyAPIConnection` on its own doesn't provide value for library consumers: it doesn't do anything domain-specific for Parsely, except purging queue after successful events. I think it's completely save to make it accessible only from the library.
No need for this field to be `public`
Every time SDK purges in-memory events queue, it purges stored queue and vice-versa. The extraction of method asserts this behaviour and increases readability
To unit test HTTP communication logic, framework agnostic.
Previously, the `ParselyAPIConnection` task was not finishing execution before the test finished. Only because the task's `onBackground` was fast, the test was passing. To remove this flakiness, the introduced change uses LooperMode.Mode.PAUSED to wait for AsyncTask execution to finish, before running assertions.
wzieba and others added 26 commits January 17, 2024 14:47
In Java implementation, `pubDate` was `@Nullable` so there's no reason
to change it in Kotlin implementation.
Reasons: to reduce responsibilities of `ParselyTracker` and introduce unit tests coverage for "no internet connection" case
Instead of returning `-1` in case of missing interval
BREAKING CHANGE: this method was part of the public contract but I can't find a justified value of it
In case of an empty `url` parameter, the SDK should not crash the application. The logging SDK is likely not as critical to the consumer business flow to the degree, that providing an incorrect argument would kill the whole process.
`toMap` will never produce `null` because it creates a new map each time
@MartinAkram MartinAkram force-pushed the add_page_type_param_to_ParselyMetadata branch from 4ec921b to c2eb7e5 Compare January 17, 2024 19:49
@MartinAkram MartinAkram changed the base branch from main to release/3.2.0 January 17, 2024 19:49
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (release/3.2.0@644cf41). Click here to learn what that means.

Additional details and impacted files
@@               Coverage Diff                @@
##             release/3.2.0     #102   +/-   ##
================================================
  Coverage                 ?   72.04%           
================================================
  Files                    ?       18           
  Lines                    ?      372           
  Branches                 ?       53           
================================================
  Hits                     ?      268           
  Misses                   ?       92           
  Partials                 ?       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

2 participants