main.com.wisetrack.sdk.SessionResponseData.kt Maven / Gradle / Ivy
package com.wisetrack.sdk
import org.json.JSONObject
/**
@author hamed (@hamed-hsb)
* @since 06th October 2021
*/
class SessionResponseData(activityPackage: ActivityPackage) : ResponseData() {
private val sdkPlatform = activityPackage.clientSdk?.let { Util.getSdkPrefixPlatform(it) }
public fun getSuccessResponseData(): WiseTrackSessionSuccess? {
if (!success) {
return null
}
val successResponseData = WiseTrackSessionSuccess()
if ("unity" == sdkPlatform) {
successResponseData.adid = adid ?: ""
successResponseData.message = message ?: ""
successResponseData.timestamp = timestamp ?: ""
successResponseData.jsonResponse = jsonResponse ?: JSONObject()
} else {
// Rest of all platforms.
successResponseData.message = message
successResponseData.timestamp = timestamp
successResponseData.adid = adid
successResponseData.jsonResponse = jsonResponse
}
return successResponseData
}
fun getFailureResponseData(): WiseTrackSessionFailure? {
if (success) {
return null
}
val failureResponseData = WiseTrackSessionFailure()
if ("unity" == sdkPlatform) {
// Unity platform.
failureResponseData.message = if (message != null) message else ""
failureResponseData.timestamp = if (timestamp != null) timestamp else ""
failureResponseData.adid = if (adid != null) adid else ""
failureResponseData.willRetry = willRetry
failureResponseData.jsonResponse =
if (jsonResponse != null) jsonResponse else JSONObject()
} else {
// Rest of all platforms.
failureResponseData.message = message
failureResponseData.timestamp = timestamp
failureResponseData.adid = adid
failureResponseData.willRetry = willRetry
failureResponseData.jsonResponse = jsonResponse
}
return failureResponseData
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy