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

RUMM-2781: Remove duplication of UserInfo and NetworkInfo classes #1170

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 4 additions & 32 deletions dd-sdk-android/apiSurface
Original file line number Diff line number Diff line change
Expand Up @@ -135,35 +135,6 @@ enum com.datadog.android.core.configuration.VitalsUpdateFrequency
- AVERAGE
- RARE
- NEVER
data class com.datadog.android.core.model.NetworkInfo
constructor(Connectivity = Connectivity.NETWORK_NOT_CONNECTED, kotlin.String? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.String? = null)
fun toJson(): com.google.gson.JsonElement
companion object
fun fromJson(kotlin.String): NetworkInfo
fun fromJsonObject(com.google.gson.JsonObject): NetworkInfo
enum Connectivity
constructor(kotlin.String)
- NETWORK_NOT_CONNECTED
- NETWORK_ETHERNET
- NETWORK_WIFI
- NETWORK_WIMAX
- NETWORK_BLUETOOTH
- NETWORK_2G
- NETWORK_3G
- NETWORK_4G
- NETWORK_5G
- NETWORK_MOBILE_OTHER
- NETWORK_CELLULAR
- NETWORK_OTHER
fun toJson(): com.google.gson.JsonElement
companion object
fun fromJson(kotlin.String): Connectivity
data class com.datadog.android.core.model.UserInfo
constructor(kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.collections.MutableMap<kotlin.String, kotlin.Any?> = mutableMapOf())
fun toJson(): com.google.gson.JsonElement
companion object
fun fromJson(kotlin.String): UserInfo
fun fromJsonObject(com.google.gson.JsonObject): UserInfo
interface com.datadog.android.event.EventMapper<T: Any>
fun map(T): T?
interface com.datadog.android.event.SpanEventMapper : EventMapper<com.datadog.android.tracing.model.SpanEvent>
Expand Down Expand Up @@ -2027,7 +1998,7 @@ interface com.datadog.android.v2.api.SdkCore
fun setVerbosity(Int)
fun getVerbosity(): Int
fun setTrackingConsent(com.datadog.android.privacy.TrackingConsent)
fun setUserInfo(com.datadog.android.core.model.UserInfo)
fun setUserInfo(com.datadog.android.v2.api.context.UserInfo)
fun addUserProperties(Map<String, Any?>)
fun stop()
fun clearAllData()
Expand All @@ -2049,8 +2020,9 @@ enum com.datadog.android.v2.api.context.DeviceType
- DESKTOP
- OTHER
data class com.datadog.android.v2.api.context.NetworkInfo
constructor(Connectivity, String?, Long?, Long?, Long?, Long?, String?)
constructor(Connectivity = Connectivity.NETWORK_NOT_CONNECTED, kotlin.String? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.String? = null)
enum Connectivity
constructor(kotlin.String)
- NETWORK_NOT_CONNECTED
- NETWORK_ETHERNET
- NETWORK_WIFI
Expand All @@ -2068,7 +2040,7 @@ data class com.datadog.android.v2.api.context.ProcessInfo
data class com.datadog.android.v2.api.context.TimeInfo
constructor(Long, Long, Long, Long)
data class com.datadog.android.v2.api.context.UserInfo
constructor(String?, String?, String?, Map<String, Any?>)
constructor(kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, Map<kotlin.String, kotlin.Any?> = emptyMap())
class com.datadog.android.webview.DatadogEventBridge
constructor()
constructor(List<String>)
Expand Down
2 changes: 0 additions & 2 deletions dd-sdk-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ apply(from = "clone_rum_schema.gradle.kts")
apply(from = "clone_telemetry_schema.gradle.kts")
apply(from = "generate_rum_models.gradle.kts")
apply(from = "generate_telemetry_models.gradle.kts")
apply(from = "generate_core_models.gradle.kts")
apply(from = "generate_trace_models.gradle.kts")
apply(from = "generate_log_models.gradle.kts")

Expand All @@ -187,7 +186,6 @@ detektConfig(
excludes = listOf(
"**/com/datadog/android/rum/model/**",
"**/com/datadog/android/telemetry/model/**",
"**/com/datadog/android/core/model/**",
"**/com/datadog/android/tracing/model/**",
"**/com/datadog/android/log/model/**"
)
Expand Down
20 changes: 0 additions & 20 deletions dd-sdk-android/generate_core_models.gradle.kts

This file was deleted.

54 changes: 0 additions & 54 deletions dd-sdk-android/src/main/json/core/network_info.json

This file was deleted.

24 changes: 0 additions & 24 deletions dd-sdk-android/src/main/json/core/user_info.json

This file was deleted.

4 changes: 2 additions & 2 deletions dd-sdk-android/src/main/kotlin/com/datadog/android/Datadog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import com.datadog.android.core.configuration.Configuration
import com.datadog.android.core.configuration.Credentials
import com.datadog.android.core.internal.utils.devLogger
import com.datadog.android.core.internal.utils.telemetry
import com.datadog.android.core.model.UserInfo
import com.datadog.android.privacy.TrackingConsent
import com.datadog.android.rum.GlobalRum
import com.datadog.android.rum.internal.monitor.DatadogRumMonitor
import com.datadog.android.v2.api.SdkCore
import com.datadog.android.v2.api.context.UserInfo
import com.datadog.android.v2.core.DatadogCore
import com.datadog.android.v2.core.NoOpSdkCore
import com.datadog.android.v2.core.internal.HashGenerator
Expand Down Expand Up @@ -173,7 +173,7 @@ object Datadog {
id,
name,
email,
extraInfo.toMutableMap()
extraInfo
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ import com.datadog.android.core.internal.time.KronosTimeProvider
import com.datadog.android.core.internal.time.LoggingSyncListener
import com.datadog.android.core.internal.time.NoOpTimeProvider
import com.datadog.android.core.internal.time.TimeProvider
import com.datadog.android.core.internal.user.DatadogUserInfoProvider
import com.datadog.android.core.internal.user.MutableUserInfoProvider
import com.datadog.android.core.internal.user.NoOpMutableUserInfoProvider
import com.datadog.android.core.internal.user.UserInfoDeserializer
import com.datadog.android.core.internal.utils.devLogger
import com.datadog.android.core.internal.utils.sdkLogger
import com.datadog.android.log.internal.user.DatadogUserInfoProvider
import com.datadog.android.log.internal.user.MutableUserInfoProvider
import com.datadog.android.log.internal.user.NoOpMutableUserInfoProvider
import com.datadog.android.log.internal.user.UserInfoDeserializer
import com.datadog.android.privacy.TrackingConsent
import com.datadog.android.rum.internal.domain.event.RumEventDeserializer
import com.datadog.android.rum.internal.ndk.DatadogNdkCrashHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.datadog.android.core.internal.persistence.Batch
import com.datadog.android.core.internal.persistence.DataReader
import com.datadog.android.core.internal.system.SystemInfoProvider
import com.datadog.android.core.internal.utils.scheduleSafe
import com.datadog.android.core.model.NetworkInfo
import com.datadog.android.v2.api.context.NetworkInfo
import java.util.concurrent.ScheduledThreadPoolExecutor
import java.util.concurrent.TimeUnit
import kotlin.math.max
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.datadog.android.core.internal.net.info.NetworkInfoProvider
import com.datadog.android.core.internal.utils.cancelUploadWorker
import com.datadog.android.core.internal.utils.isWorkManagerInitialized
import com.datadog.android.core.internal.utils.triggerUploadWorker
import com.datadog.android.core.model.NetworkInfo
import com.datadog.android.v2.api.context.NetworkInfo
import java.lang.ref.Reference
import java.lang.ref.WeakReference

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import com.datadog.android.core.internal.persistence.DataWriter
import com.datadog.android.core.internal.receiver.ThreadSafeReceiver
import com.datadog.android.core.internal.system.BuildSdkVersionProvider
import com.datadog.android.core.internal.system.DefaultBuildSdkVersionProvider
import com.datadog.android.core.model.NetworkInfo
import com.datadog.android.v2.api.context.NetworkInfo
import android.net.NetworkInfo as AndroidNetworkInfo

@Suppress("DEPRECATION")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.datadog.android.core.internal.persistence.DataWriter
import com.datadog.android.core.internal.system.BuildSdkVersionProvider
import com.datadog.android.core.internal.system.DefaultBuildSdkVersionProvider
import com.datadog.android.core.internal.utils.devLogger
import com.datadog.android.core.model.NetworkInfo
import com.datadog.android.v2.api.context.NetworkInfo

@TargetApi(Build.VERSION_CODES.N)
internal class CallbackNetworkInfoProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
package com.datadog.android.core.internal.net.info

import com.datadog.android.core.internal.persistence.Deserializer
import com.datadog.android.core.model.NetworkInfo
import com.datadog.android.log.Logger
import com.datadog.android.log.internal.utils.errorWithTelemetry
import com.datadog.android.v2.api.context.NetworkInfo
import com.google.gson.JsonParseException
import java.util.Locale

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package com.datadog.android.core.internal.net.info

import android.content.Context
import com.datadog.android.core.model.NetworkInfo
import com.datadog.android.v2.api.context.NetworkInfo
import com.datadog.tools.annotation.NoOpImplementation

@NoOpImplementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package com.datadog.android.core.internal.net.info

import com.datadog.android.core.internal.persistence.Serializer
import com.datadog.android.core.model.NetworkInfo
import com.datadog.android.v2.api.context.NetworkInfo

internal class NetworkInfoSerializer :
Serializer<NetworkInfo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Copyright 2016-Present Datadog, Inc.
*/

package com.datadog.android.log.internal.user
package com.datadog.android.core.internal.user

import com.datadog.android.core.internal.persistence.DataWriter
import com.datadog.android.core.model.UserInfo
import com.datadog.android.v2.api.context.UserInfo

internal class DatadogUserInfoProvider(
internal val dataWriter: DataWriter<UserInfo>
Expand All @@ -25,8 +25,9 @@ internal class DatadogUserInfoProvider(
}

override fun addUserProperties(properties: Map<String, Any?>) {
internalUserInfo.additionalProperties
.putAll(properties)
internalUserInfo = internalUserInfo.copy(
additionalProperties = internalUserInfo.additionalProperties + properties
)
}

override fun getUserInfo(): UserInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* Copyright 2016-Present Datadog, Inc.
*/

package com.datadog.android.log.internal.user
package com.datadog.android.core.internal.user

import com.datadog.android.core.model.UserInfo
import com.datadog.android.v2.api.context.UserInfo
import com.datadog.tools.annotation.NoOpImplementation

@NoOpImplementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* Copyright 2016-Present Datadog, Inc.
*/

package com.datadog.android.log.internal.user
package com.datadog.android.core.internal.user

import com.datadog.android.core.internal.persistence.Deserializer
import com.datadog.android.core.model.UserInfo
import com.datadog.android.log.Logger
import com.datadog.android.log.internal.utils.errorWithTelemetry
import com.datadog.android.v2.api.context.UserInfo
import com.google.gson.JsonParseException
import java.util.Locale

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* Copyright 2016-Present Datadog, Inc.
*/

package com.datadog.android.log.internal.user
package com.datadog.android.core.internal.user

import com.datadog.android.core.model.UserInfo
import com.datadog.android.v2.api.context.UserInfo
import com.datadog.tools.annotation.NoOpImplementation

@NoOpImplementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
* Copyright 2016-Present Datadog, Inc.
*/

package com.datadog.android.log.internal.user
package com.datadog.android.core.internal.user

import com.datadog.android.core.internal.persistence.Serializer
import com.datadog.android.core.model.UserInfo
import com.datadog.android.v2.api.context.UserInfo

internal class UserInfoSerializer :
Serializer<UserInfo> {
internal class UserInfoSerializer : Serializer<UserInfo> {

override fun serialize(model: UserInfo): String {
return model.toJson().asJsonObject.toString()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import androidx.annotation.AnyThread
import com.datadog.android.core.configuration.Configuration
import com.datadog.android.core.internal.utils.devLogger
import com.datadog.android.core.internal.utils.sdkLogger
import com.datadog.android.core.model.NetworkInfo
import com.datadog.android.core.model.UserInfo
import com.datadog.android.event.MapperSerializer
import com.datadog.android.log.internal.domain.DatadogLogGenerator
import com.datadog.android.log.internal.domain.event.LogEventMapperWrapper
import com.datadog.android.log.internal.domain.event.LogEventSerializer
import com.datadog.android.log.model.LogEvent
import com.datadog.android.v2.api.FeatureEventReceiver
import com.datadog.android.v2.api.SdkCore
import com.datadog.android.v2.api.context.NetworkInfo
import com.datadog.android.v2.api.context.UserInfo
import com.datadog.android.v2.core.internal.storage.DataWriter
import com.datadog.android.v2.core.internal.storage.NoOpDataWriter
import com.datadog.android.v2.log.internal.storage.LogsDataWriter
Expand Down
Loading