main.com.wisetrack.sdk.ResponseData.kt Maven / Gradle / Ivy
package com.wisetrack.sdk
import org.json.JSONObject
/**
@author hamed (@hamed-hsb)
* @since 04th October 2021
*/
open class ResponseData {
var success = false
var willRetry = false
var adid: String? = null
var message: String? = null
var timestamp: String? = null
var jsonResponse: JSONObject? = null
var activityKind: ActivityKind? = null
var trackingState: TrackingState? = null
var attribution: WiseTrackAttribution? = null
var askIn: Long? = null
var retryIn: Long? = null
var continueIn: Long? = null
var activityPackage: ActivityPackage? = null
var sendingParameters: Map? = null
companion object {
@JvmStatic
fun buildResponseData(
activityPackage: ActivityPackage,
sendingParameters: Map?
): ResponseData {
val responseData: ResponseData?
val activityKind = activityPackage.activityKind
responseData = when (activityKind) {
ActivityKind.SESSION -> SessionResponseData(activityPackage)
ActivityKind.CLICK -> SdkClickResponseData()
ActivityKind.ATTRIBUTION -> AttributionResponseData()
ActivityKind.EVENT -> EventResponseData(activityPackage)
else -> ResponseData()
}
responseData.activityKind = activityKind
responseData.activityPackage = activityPackage
responseData.sendingParameters = sendingParameters
return responseData
}
}
override fun toString(): String {
return "message:$message timestamp:$timestamp json:$jsonResponse"
}
}