All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.com.wisetrack.sdk.ResponseData.kt Maven / Gradle / Ivy

There is a newer version: 1.5.3
Show newest version
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"
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy