-
Notifications
You must be signed in to change notification settings - Fork 0
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
Tracking events domain objects #4
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4 +/- ##
============================================
+ Coverage 67.58% 69.17% +1.59%
- Complexity 0 1 +1
============================================
Files 8 8
Lines 145 146 +1
Branches 19 19
============================================
+ Hits 98 101 +3
+ Misses 39 37 -2
Partials 8 8
Continue to review full report at Codecov.
|
5dec36f
to
0e7ab83
Compare
49d219c
to
be5b596
Compare
be5b596
to
f2f98eb
Compare
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.
Apart from what I left as comments, I also think that siteId
and clientId
should not be optional when instantiating an instance of TrackingEvent. All subclasses should require those fields in the constructor. Also, personal opinion, don't really like that we have all the possible properties declared in the class constructor. This leads to really big constructors. But this is more of a personal thing, don't have a really strong opinion about this
velocidi-sdk/src/main/kotlin/com/velocidi/events/CustomTrackingEvent.kt
Outdated
Show resolved
Hide resolved
velocidi-sdk/src/main/kotlin/com/velocidi/events/CustomTrackingEvent.kt
Outdated
Show resolved
Hide resolved
velocidi-sdk/src/main/kotlin/com/velocidi/events/ProductView.kt
Outdated
Show resolved
Hide resolved
velocidi-sdk/src/main/kotlin/com/velocidi/events/ProductViewDetails.kt
Outdated
Show resolved
Hide resolved
velocidi-sdk/src/main/kotlin/com/velocidi/events/ProductFeedback.kt
Outdated
Show resolved
Hide resolved
velocidi-sdk/src/main/kotlin/com/velocidi/events/RemoveFromCart.kt
Outdated
Show resolved
Hide resolved
velocidi-sdk/src/main/kotlin/com/velocidi/events/Subscription.kt
Outdated
Show resolved
Hide resolved
89a15ad
to
cfc344d
Compare
cfc344d
to
1602290
Compare
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.
I changed all the product
to products
in 6305e05 and also upgraded the kotlinx-serialization to v0.11
. Now, optional fields no longer need the optional annotation.
Improved in 38af754 |
About this, due to the offline conversation that we had, If in the future we drop the |
I've been doing some testing and For example:
In this case, it would only serialize siteId, clientId and I also tried changing I think the best solution is leaving it like it is. |
What about replacing |
I think with Gson we couldn't have inheritance and we could only generate JSON from If you think it's worth I can explore |
Yes, please. Just give it a quick look and see if it is feasible. |
319ee54
to
541184f
Compare
…gEvent serialization
541184f
to
faedd38
Compare
Sorry for nitpicking on this, but can you do the same for |
Improved in 9c89eb0 |
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!
Depends on #3
This PR adds tracking events objects. Now the tracking function uses these objects instead of just a
JSONObject
. To allow the user to send their own types I created aCustomTrackingEvent
that accepts a JSONObject and only validates itstype
,clientId
andsiteId
.