@@ -9,14 +9,13 @@ import com.segment.analytics.kotlin.core.platform.plugins.SegmentDestination
99import com.segment.analytics.kotlin.core.platform.plugins.StartupQueue
1010import com.segment.analytics.kotlin.core.platform.plugins.UserInfoPlugin
1111import com.segment.analytics.kotlin.core.platform.plugins.logger.*
12+ import com.segment.analytics.kotlin.core.utilities.JsonAnySerializer
1213import kotlinx.coroutines.*
13- import kotlinx.serialization.DeserializationStrategy
14- import kotlinx.serialization.SerializationStrategy
14+ import kotlinx.serialization.*
1515import kotlinx.serialization.json.Json
1616import kotlinx.serialization.json.Json.Default.decodeFromJsonElement
1717import kotlinx.serialization.json.JsonObject
1818import kotlinx.serialization.json.jsonObject
19- import kotlinx.serialization.serializer
2019import sovran.kotlin.Store
2120import sovran.kotlin.Subscriber
2221import java.util.*
@@ -99,11 +98,11 @@ open class Analytics protected constructor(
9998 )
10099 }
101100 override val analyticsScope = CoroutineScope (SupervisorJob () + exceptionHandler)
102- override val analyticsDispatcher : CloseableCoroutineDispatcher =
101+ override val analyticsDispatcher: CloseableCoroutineDispatcher =
103102 Executors .newCachedThreadPool().asCoroutineDispatcher()
104- override val networkIODispatcher : CloseableCoroutineDispatcher =
103+ override val networkIODispatcher: CloseableCoroutineDispatcher =
105104 Executors .newSingleThreadExecutor().asCoroutineDispatcher()
106- override val fileIODispatcher : CloseableCoroutineDispatcher =
105+ override val fileIODispatcher: CloseableCoroutineDispatcher =
107106 Executors .newFixedThreadPool(2 ).asCoroutineDispatcher()
108107 })
109108
@@ -161,7 +160,7 @@ open class Analytics protected constructor(
161160 * @param serializationStrategy strategy to serialize [properties]
162161 * @see <a href="https://segment.com/docs/spec/track/">Track Documentation</a>
163162 */
164- fun <T : Any > track (
163+ fun <T > track (
165164 name : String ,
166165 properties : T ,
167166 serializationStrategy : SerializationStrategy <T >,
@@ -178,11 +177,11 @@ open class Analytics protected constructor(
178177 * @param properties to describe the action. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md)
179178 * @see <a href="https://segment.com/docs/spec/track/">Track Documentation</a>
180179 */
181- inline fun <reified T : Any > track (
180+ inline fun <reified T > track (
182181 name : String ,
183182 properties : T ,
184183 ) {
185- track(name, properties, Json .serializersModule.serializer())
184+ track(name, properties, JsonAnySerializer .serializersModule.serializer())
186185 }
187186
188187 /* *
@@ -227,7 +226,7 @@ open class Analytics protected constructor(
227226 * @param serializationStrategy strategy to serialize [traits]
228227 * @see <a href="https://segment.com/docs/spec/identify/">Identify Documentation</a>
229228 */
230- fun <T : Any > identify (
229+ fun <T > identify (
231230 userId : String ,
232231 traits : T ,
233232 serializationStrategy : SerializationStrategy <T >,
@@ -250,10 +249,10 @@ open class Analytics protected constructor(
250249 * @param traits [Traits] about the user. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md)
251250 * @see <a href="https://segment.com/docs/spec/identify/">Identify Documentation</a>
252251 */
253- inline fun <reified T : Any > identify (
252+ inline fun <reified T > identify (
254253 traits : T ,
255254 ) {
256- identify(traits, Json .serializersModule.serializer())
255+ identify(traits, JsonAnySerializer .serializersModule.serializer())
257256 }
258257
259258 /* *
@@ -298,7 +297,7 @@ open class Analytics protected constructor(
298297 * @param serializationStrategy strategy to serialize [traits]
299298 * @see <a href="https://segment.com/docs/spec/identify/">Identify Documentation</a>
300299 */
301- fun <T : Any > identify (
300+ fun <T > identify (
302301 traits : T ,
303302 serializationStrategy : SerializationStrategy <T >,
304303 ) {
@@ -321,11 +320,11 @@ open class Analytics protected constructor(
321320 * @param traits [Traits] about the user. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md)
322321 * @see <a href="https://segment.com/docs/spec/identify/">Identify Documentation</a>
323322 */
324- inline fun <reified T : Any > identify (
323+ inline fun <reified T > identify (
325324 userId : String ,
326325 traits : T ,
327326 ) {
328- identify(userId, traits, Json .serializersModule.serializer())
327+ identify(userId, traits, JsonAnySerializer .serializersModule.serializer())
329328 }
330329
331330 /* *
@@ -359,7 +358,7 @@ open class Analytics protected constructor(
359358 * @param serializationStrategy strategy to serialize [properties]
360359 * @see <a href="https://segment.com/docs/spec/screen/">Screen Documentation</a>
361360 */
362- fun <T : Any > screen (
361+ fun <T > screen (
363362 title : String ,
364363 properties : T ,
365364 serializationStrategy : SerializationStrategy <T >,
@@ -382,12 +381,12 @@ open class Analytics protected constructor(
382381 * @param properties [Properties] to add extra information to this call. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md)
383382 * @see <a href="https://segment.com/docs/spec/screen/">Screen Documentation</a>
384383 */
385- inline fun <reified T : Any > screen (
384+ inline fun <reified T > screen (
386385 title : String ,
387386 properties : T ,
388387 category : String = "",
389388 ) {
390- screen(title, properties, Json .serializersModule.serializer(), category)
389+ screen(title, properties, JsonAnySerializer .serializersModule.serializer(), category)
391390 }
392391
393392 /* *
@@ -419,7 +418,7 @@ open class Analytics protected constructor(
419418 * @param serializationStrategy strategy to serialize [traits]
420419 * @see <a href="https://segment.com/docs/spec/group/">Group Documentation</a>
421420 */
422- fun <T : Any > group (
421+ fun <T > group (
423422 groupId : String ,
424423 traits : T ,
425424 serializationStrategy : SerializationStrategy <T >,
@@ -438,11 +437,11 @@ open class Analytics protected constructor(
438437 * @param traits [Traits] about the group. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md)
439438 * @see <a href="https://segment.com/docs/spec/group/">Group Documentation</a>
440439 */
441- inline fun <reified T : Any > group (
440+ inline fun <reified T > group (
442441 groupId : String ,
443442 traits : T ,
444443 ) {
445- group(groupId, traits, Json .serializersModule.serializer())
444+ group(groupId, traits, JsonAnySerializer .serializersModule.serializer())
446445 }
447446
448447 /* *
@@ -613,7 +612,7 @@ open class Analytics protected constructor(
613612 /* *
614613 * Retrieve the traits registered by a previous `identify` call in a blocking way.
615614 */
616- inline fun <reified T : Any > traits (deserializationStrategy : DeserializationStrategy <T > = Json .serializersModule.serializer()): T ? {
615+ inline fun <reified T > traits (deserializationStrategy : DeserializationStrategy <T > = Json .serializersModule.serializer()): T ? {
617616 return traits()?.let {
618617 decodeFromJsonElement(deserializationStrategy, it)
619618 }
@@ -626,7 +625,7 @@ open class Analytics protected constructor(
626625 " This function no longer serves a purpose and internally calls `traits(deserializationStrategy: DeserializationStrategy<T>)`." ,
627626 ReplaceWith (" traits(deserializationStrategy: DeserializationStrategy<T>)" )
628627 )
629- inline fun <reified T : Any > traitsAsync (deserializationStrategy : DeserializationStrategy <T > = Json .serializersModule.serializer()): T ? {
628+ inline fun <reified T > traitsAsync (deserializationStrategy : DeserializationStrategy <T > = Json .serializersModule.serializer()): T ? {
630629 return traits(deserializationStrategy)
631630 }
632631
0 commit comments