Skip to content

Commit

Permalink
[DIA-2585] Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevazhnovu authored and carmelo-iriti committed Feb 9, 2024
1 parent 601747e commit 557e91f
Showing 1 changed file with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.sourcepoint.cmplibrary.data.Service
import com.sourcepoint.cmplibrary.data.local.DataStorage
import com.sourcepoint.cmplibrary.data.network.connection.ConnectionManager
import com.sourcepoint.cmplibrary.data.network.converter.JsonConverter
import com.sourcepoint.cmplibrary.data.network.converter.converter
import com.sourcepoint.cmplibrary.data.network.model.optimized.CampaignMessage
import com.sourcepoint.cmplibrary.data.network.model.optimized.MessagesResp
import com.sourcepoint.cmplibrary.data.network.model.optimized.stringify
Expand All @@ -36,7 +35,6 @@ import com.sourcepoint.cmplibrary.util.check
import com.sourcepoint.cmplibrary.util.checkMainThread
import com.sourcepoint.cmplibrary.util.extensions.toMessageType
import com.sourcepoint.cmplibrary.util.toConsentLibException
import kotlinx.serialization.encodeToString
import okhttp3.HttpUrl.Companion.toHttpUrl
import org.json.JSONObject
import java.util.* // ktlint-disable
Expand Down Expand Up @@ -304,16 +302,17 @@ internal class SpConsentLibImpl(
categories = categories.toList(),
legIntCategories = legIntCategories.toList(),
success = {
check { JsonConverter.converter.encodeToString(it) }
.executeOnRight { r -> successCallback.transferCustomConsentToUnity(r) }
.executeOnLeft {
spClient.onError(RuntimeException("An error occurred during the custom consent request"))
pLogger.clientEvent(
event = "onError",
msg = "An error occurred during the custom consent request",
content = "An error occurred during the custom consent request"
)
}
it?.let { spc ->
check { spc.toJsonObject().toString() }
.map { successCallback.transferCustomConsentToUnity(it) }
} ?: run {
spClient.onError(RuntimeException("An error occurred during the custom consent request"))
pLogger.clientEvent(
event = "onError",
msg = "An error occurred during the custom consent request",
content = "An error occurred during the custom consent request"
)
}
}
)
}
Expand All @@ -329,16 +328,17 @@ internal class SpConsentLibImpl(
categories = categories.toList(),
legIntCategories = legIntCategories.toList(),
success = {
check { JsonConverter.converter.encodeToString(it) }
.executeOnRight { r -> successCallback.transferCustomConsentToUnity(r) }
.executeOnLeft {
spClient.onError(RuntimeException("An error occurred during delete custom consent request"))
pLogger.clientEvent(
event = "onError",
msg = "An error occurred during delete custom consent request",
content = "An error occurred during delete custom consent request"
)
}
it?.let { spc ->
check { spc.toJsonObject().toString() }
.map { successCallback.transferCustomConsentToUnity(it) }
} ?: run {
spClient.onError(RuntimeException("An error occurred during delete custom consent request"))
pLogger.clientEvent(
event = "onError",
msg = "An error occurred during delete custom consent request",
content = "An error occurred during delete custom consent request"
)
}
}
)
}
Expand Down

0 comments on commit 557e91f

Please sign in to comment.