@@ -9,14 +9,13 @@ import com.segment.analytics.kotlin.core.platform.plugins.SegmentDestination
9
9
import com.segment.analytics.kotlin.core.platform.plugins.StartupQueue
10
10
import com.segment.analytics.kotlin.core.platform.plugins.UserInfoPlugin
11
11
import com.segment.analytics.kotlin.core.platform.plugins.logger.*
12
+ import com.segment.analytics.kotlin.core.utilities.JsonAnySerializer
12
13
import kotlinx.coroutines.*
13
- import kotlinx.serialization.DeserializationStrategy
14
- import kotlinx.serialization.SerializationStrategy
14
+ import kotlinx.serialization.*
15
15
import kotlinx.serialization.json.Json
16
16
import kotlinx.serialization.json.Json.Default.decodeFromJsonElement
17
17
import kotlinx.serialization.json.JsonObject
18
18
import kotlinx.serialization.json.jsonObject
19
- import kotlinx.serialization.serializer
20
19
import sovran.kotlin.Store
21
20
import sovran.kotlin.Subscriber
22
21
import java.util.*
@@ -99,11 +98,11 @@ open class Analytics protected constructor(
99
98
)
100
99
}
101
100
override val analyticsScope = CoroutineScope (SupervisorJob () + exceptionHandler)
102
- override val analyticsDispatcher : CloseableCoroutineDispatcher =
101
+ override val analyticsDispatcher: CloseableCoroutineDispatcher =
103
102
Executors .newCachedThreadPool().asCoroutineDispatcher()
104
- override val networkIODispatcher : CloseableCoroutineDispatcher =
103
+ override val networkIODispatcher: CloseableCoroutineDispatcher =
105
104
Executors .newSingleThreadExecutor().asCoroutineDispatcher()
106
- override val fileIODispatcher : CloseableCoroutineDispatcher =
105
+ override val fileIODispatcher: CloseableCoroutineDispatcher =
107
106
Executors .newFixedThreadPool(2 ).asCoroutineDispatcher()
108
107
})
109
108
@@ -161,7 +160,7 @@ open class Analytics protected constructor(
161
160
* @param serializationStrategy strategy to serialize [properties]
162
161
* @see <a href="https://segment.com/docs/spec/track/">Track Documentation</a>
163
162
*/
164
- fun <T : Any > track (
163
+ fun <T > track (
165
164
name : String ,
166
165
properties : T ,
167
166
serializationStrategy : SerializationStrategy <T >,
@@ -178,11 +177,11 @@ open class Analytics protected constructor(
178
177
* @param properties to describe the action. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md)
179
178
* @see <a href="https://segment.com/docs/spec/track/">Track Documentation</a>
180
179
*/
181
- inline fun <reified T : Any > track (
180
+ inline fun <reified T > track (
182
181
name : String ,
183
182
properties : T ,
184
183
) {
185
- track(name, properties, Json .serializersModule.serializer())
184
+ track(name, properties, JsonAnySerializer .serializersModule.serializer())
186
185
}
187
186
188
187
/* *
@@ -227,7 +226,7 @@ open class Analytics protected constructor(
227
226
* @param serializationStrategy strategy to serialize [traits]
228
227
* @see <a href="https://segment.com/docs/spec/identify/">Identify Documentation</a>
229
228
*/
230
- fun <T : Any > identify (
229
+ fun <T > identify (
231
230
userId : String ,
232
231
traits : T ,
233
232
serializationStrategy : SerializationStrategy <T >,
@@ -250,10 +249,10 @@ open class Analytics protected constructor(
250
249
* @param traits [Traits] about the user. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md)
251
250
* @see <a href="https://segment.com/docs/spec/identify/">Identify Documentation</a>
252
251
*/
253
- inline fun <reified T : Any > identify (
252
+ inline fun <reified T > identify (
254
253
traits : T ,
255
254
) {
256
- identify(traits, Json .serializersModule.serializer())
255
+ identify(traits, JsonAnySerializer .serializersModule.serializer())
257
256
}
258
257
259
258
/* *
@@ -298,7 +297,7 @@ open class Analytics protected constructor(
298
297
* @param serializationStrategy strategy to serialize [traits]
299
298
* @see <a href="https://segment.com/docs/spec/identify/">Identify Documentation</a>
300
299
*/
301
- fun <T : Any > identify (
300
+ fun <T > identify (
302
301
traits : T ,
303
302
serializationStrategy : SerializationStrategy <T >,
304
303
) {
@@ -321,11 +320,11 @@ open class Analytics protected constructor(
321
320
* @param traits [Traits] about the user. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md)
322
321
* @see <a href="https://segment.com/docs/spec/identify/">Identify Documentation</a>
323
322
*/
324
- inline fun <reified T : Any > identify (
323
+ inline fun <reified T > identify (
325
324
userId : String ,
326
325
traits : T ,
327
326
) {
328
- identify(userId, traits, Json .serializersModule.serializer())
327
+ identify(userId, traits, JsonAnySerializer .serializersModule.serializer())
329
328
}
330
329
331
330
/* *
@@ -359,7 +358,7 @@ open class Analytics protected constructor(
359
358
* @param serializationStrategy strategy to serialize [properties]
360
359
* @see <a href="https://segment.com/docs/spec/screen/">Screen Documentation</a>
361
360
*/
362
- fun <T : Any > screen (
361
+ fun <T > screen (
363
362
title : String ,
364
363
properties : T ,
365
364
serializationStrategy : SerializationStrategy <T >,
@@ -382,12 +381,12 @@ open class Analytics protected constructor(
382
381
* @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)
383
382
* @see <a href="https://segment.com/docs/spec/screen/">Screen Documentation</a>
384
383
*/
385
- inline fun <reified T : Any > screen (
384
+ inline fun <reified T > screen (
386
385
title : String ,
387
386
properties : T ,
388
387
category : String = "",
389
388
) {
390
- screen(title, properties, Json .serializersModule.serializer(), category)
389
+ screen(title, properties, JsonAnySerializer .serializersModule.serializer(), category)
391
390
}
392
391
393
392
/* *
@@ -419,7 +418,7 @@ open class Analytics protected constructor(
419
418
* @param serializationStrategy strategy to serialize [traits]
420
419
* @see <a href="https://segment.com/docs/spec/group/">Group Documentation</a>
421
420
*/
422
- fun <T : Any > group (
421
+ fun <T > group (
423
422
groupId : String ,
424
423
traits : T ,
425
424
serializationStrategy : SerializationStrategy <T >,
@@ -438,11 +437,11 @@ open class Analytics protected constructor(
438
437
* @param traits [Traits] about the group. Needs to be [serializable](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md)
439
438
* @see <a href="https://segment.com/docs/spec/group/">Group Documentation</a>
440
439
*/
441
- inline fun <reified T : Any > group (
440
+ inline fun <reified T > group (
442
441
groupId : String ,
443
442
traits : T ,
444
443
) {
445
- group(groupId, traits, Json .serializersModule.serializer())
444
+ group(groupId, traits, JsonAnySerializer .serializersModule.serializer())
446
445
}
447
446
448
447
/* *
@@ -613,7 +612,7 @@ open class Analytics protected constructor(
613
612
/* *
614
613
* Retrieve the traits registered by a previous `identify` call in a blocking way.
615
614
*/
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 ? {
617
616
return traits()?.let {
618
617
decodeFromJsonElement(deserializationStrategy, it)
619
618
}
@@ -626,7 +625,7 @@ open class Analytics protected constructor(
626
625
" This function no longer serves a purpose and internally calls `traits(deserializationStrategy: DeserializationStrategy<T>)`." ,
627
626
ReplaceWith (" traits(deserializationStrategy: DeserializationStrategy<T>)" )
628
627
)
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 ? {
630
629
return traits(deserializationStrategy)
631
630
}
632
631
0 commit comments