Skip to content

Commit

Permalink
Renaming constants
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoud-elmorabea committed Jan 4, 2025
1 parent 9001b8b commit 4c1d6a0
Showing 1 changed file with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ internal class TrackingMigrationProcessor(
) : MigrationProcessor, Subscriber {

companion object {
private const val DEVICE_PAYLOAD_JSON_KEY = "device"
private const val DEVICE_TOKEN_PAYLOAD_JSON_KEY = "token"
private const val DEVICE_TYPE_PAYLOAD_JSON_KEY = "type"
private const val DEVICE_TYPE_PAYLOAD_JSON_VALUE = "android"
private const val PAYLOAD_JSON_KEY_DEVICE = "device"
private const val PAYLOAD_JSON_KEY_TOKEN = "token"
private const val PAYLOAD_JSON_KEY_TYPE = "type"
private const val PAYLOAD_JSON_VALUE_ANDROID = "android"
}

private val logger: Logger = SDKComponent.logger
Expand Down Expand Up @@ -110,24 +110,24 @@ internal class TrackingMigrationProcessor(
event = EventNames.DEVICE_DELETE,
properties = buildJsonObject {
put(
DEVICE_PAYLOAD_JSON_KEY,
PAYLOAD_JSON_KEY_DEVICE,
buildJsonObject {
put(DEVICE_TOKEN_PAYLOAD_JSON_KEY, oldDeviceToken)
put(DEVICE_TYPE_PAYLOAD_JSON_KEY, DEVICE_TYPE_PAYLOAD_JSON_VALUE)
put(PAYLOAD_JSON_KEY_TOKEN, oldDeviceToken)
put(PAYLOAD_JSON_KEY_TYPE, PAYLOAD_JSON_VALUE_ANDROID)
}
)
}
)
analytics.process(deleteDeviceEvent) { event ->
event?.putInContextUnderKey(
DEVICE_PAYLOAD_JSON_KEY,
DEVICE_TOKEN_PAYLOAD_JSON_KEY,
PAYLOAD_JSON_KEY_DEVICE,
PAYLOAD_JSON_KEY_TOKEN,
oldDeviceToken
)
event?.putInContextUnderKey(
DEVICE_PAYLOAD_JSON_KEY,
DEVICE_TYPE_PAYLOAD_JSON_KEY,
DEVICE_TYPE_PAYLOAD_JSON_VALUE
PAYLOAD_JSON_KEY_DEVICE,
PAYLOAD_JSON_KEY_TYPE,
PAYLOAD_JSON_VALUE_ANDROID
)
}
}
Expand Down Expand Up @@ -191,24 +191,24 @@ internal class TrackingMigrationProcessor(
properties = buildJsonObject {
putAll(task.attributes.toJsonObject())
put(
DEVICE_PAYLOAD_JSON_KEY,
PAYLOAD_JSON_KEY_DEVICE,
buildJsonObject {
put(DEVICE_TOKEN_PAYLOAD_JSON_KEY, task.token)
put(DEVICE_TYPE_PAYLOAD_JSON_KEY, DEVICE_TYPE_PAYLOAD_JSON_VALUE)
put(PAYLOAD_JSON_KEY_TOKEN, task.token)
put(PAYLOAD_JSON_KEY_TYPE, PAYLOAD_JSON_VALUE_ANDROID)
}
)
}
),
enrichmentClosure = { event ->
event?.putInContextUnderKey(
DEVICE_PAYLOAD_JSON_KEY,
DEVICE_TOKEN_PAYLOAD_JSON_KEY,
PAYLOAD_JSON_KEY_DEVICE,
PAYLOAD_JSON_KEY_TOKEN,
task.token
)
event?.putInContextUnderKey(
DEVICE_PAYLOAD_JSON_KEY,
DEVICE_TYPE_PAYLOAD_JSON_KEY,
DEVICE_TYPE_PAYLOAD_JSON_VALUE
PAYLOAD_JSON_KEY_DEVICE,
PAYLOAD_JSON_KEY_TYPE,
PAYLOAD_JSON_VALUE_ANDROID
)
}
)
Expand All @@ -218,24 +218,24 @@ internal class TrackingMigrationProcessor(
event = EventNames.DEVICE_DELETE,
properties = buildJsonObject {
put(
DEVICE_PAYLOAD_JSON_KEY,
PAYLOAD_JSON_KEY_DEVICE,
buildJsonObject {
put(DEVICE_TOKEN_PAYLOAD_JSON_KEY, task.token)
put(DEVICE_TYPE_PAYLOAD_JSON_KEY, DEVICE_TYPE_PAYLOAD_JSON_VALUE)
put(PAYLOAD_JSON_KEY_TOKEN, task.token)
put(PAYLOAD_JSON_KEY_TYPE, PAYLOAD_JSON_VALUE_ANDROID)
}
)
}
),
enrichmentClosure = { event ->
event?.putInContextUnderKey(
DEVICE_PAYLOAD_JSON_KEY,
DEVICE_TOKEN_PAYLOAD_JSON_KEY,
PAYLOAD_JSON_KEY_DEVICE,
PAYLOAD_JSON_KEY_TOKEN,
task.token
)
event?.putInContextUnderKey(
DEVICE_PAYLOAD_JSON_KEY,
DEVICE_TYPE_PAYLOAD_JSON_KEY,
DEVICE_TYPE_PAYLOAD_JSON_VALUE
PAYLOAD_JSON_KEY_DEVICE,
PAYLOAD_JSON_KEY_TYPE,
PAYLOAD_JSON_VALUE_ANDROID
)
}
)
Expand Down

0 comments on commit 4c1d6a0

Please sign in to comment.