-
Notifications
You must be signed in to change notification settings - Fork 32
Support Map<String, Any> for properties and traits. #168
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
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
=============================================
- Coverage 79.06% 45.69% -33.37%
+ Complexity 482 14 -468
=============================================
Files 75 8 -67
Lines 6061 860 -5201
Branches 741 81 -660
=============================================
- Hits 4792 393 -4399
+ Misses 684 437 -247
+ Partials 585 30 -555 ☔ View full report in Codecov by Sentry. |
…Have JavaAnalytics call APIs in Analytics for support. Add tests
…ted inline <reified T: Any> functions that now known to send Map<*,*> to our new AnySerializer object.
@@ -24,13 +24,13 @@ test { | |||
dependencies { | |||
// MAIN DEPS | |||
api 'com.segment:sovran-kotlin:1.2.2' | |||
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" | |||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' | |||
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1" |
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.
update the kotlin libs version. need to do the same for android gradle
@@ -170,15 +171,14 @@ open class Analytics protected constructor( | |||
* @param properties to describe the action. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md) | |||
* @see <a href="https://segment.com/docs/spec/track/">Track Documentation</a> | |||
*/ | |||
inline fun <reified T : Any> track( | |||
inline fun <reified T> track( |
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.
removed Any
. this was what causes Any serializer not found
} else { | ||
track(name, properties, Json.serializersModule.serializer()) | ||
} | ||
val format = Json { serializersModule = SerializersModule { |
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.
need to move format
to utilities. we gonna need it for the other calls
@OptIn(InternalSerializationApi::class) | ||
override val descriptor: SerialDescriptor = buildSerialDescriptor("My Any Serializer", SerialKind.CONTEXTUAL) | ||
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class) | ||
override val descriptor: SerialDescriptor = ContextualSerializer(Any::class, null, emptyArray()).descriptor |
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 think this change doesn't matter. just nice to have, instead of init it arbitrary
… definition to just <T>. Note: currently failing test: 'identify with only map traits'
…the CI destinations test.
…o limit the SDK used to 31 since robolectric only currently supports upto sdk 31.
…in that had breaking changes because of the update.
/** | ||
* A pre-configured Json Implementation with an Any type serializer. | ||
*/ | ||
val JsonSerializer = Json { serializersModule = SerializersModule { |
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.
JsonSerializer
feels a bit too more generic. I was confused it with Json
when I read the code. feel AnySerializer
is a better name, even we kind randomly named it. Can we change it to something else that reflects its actual use case?
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.
Ugh... name conflicts with the AnySerializer
that does the actually work. I changed it to JsonAnySerializer
.
No description provided.