Skip to content

Commit

Permalink
move logic check inside shouldCallConsentStatus for DIA-2542-local-da…
Browse files Browse the repository at this point in the history
…ta-versioning
  • Loading branch information
bohdan-go-wombat committed Oct 10, 2023
1 parent d94955f commit 4c8fd31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ internal interface CampaignManager {
// Optimized
val shouldCallMessages: Boolean
val shouldCallConsentStatus: Boolean
val requiresNewConsentData: Boolean
var gdprMessageMetaData: MessageMetaData?
var ccpaMessageMetaData: MessageMetaData?

Expand Down Expand Up @@ -412,23 +411,25 @@ private class CampaignManagerImpl(
val localStateSize = messagesOptimizedLocalState?.jsonObject?.size ?: 0
val isV6LocalStatePresent = dataStorage.preference.all.containsKey(LOCAL_STATE)
val isV6LocalStatePresent2 = dataStorage.preference.all.containsKey(DataStorage.LOCAL_STATE_OLD)
val res =
((gdprUUID != null || ccpaUUID != null) && localStateSize == 0) || isV6LocalStatePresent || isV6LocalStatePresent2
val isRequireNewConsentData = dataStorage.localDataVersion < DataStorage.HARDCODED_LOCAL_DATA_VERSION
val res = ((gdprUUID != null || ccpaUUID != null) && localStateSize == 0) ||
isV6LocalStatePresent ||
isV6LocalStatePresent2 ||
isRequireNewConsentData

logger?.computation(
tag = "shouldCallConsentStatus",
msg = """
gdprUUID != null [${gdprUUID != null}] - ccpaUUID != null [${ccpaUUID != null}]
localStateSize empty [${localStateSize == 0}]
V6.7 ls [$isV6LocalStatePresent] or V6.3 ls [$isV6LocalStatePresent2]
V6.7 ls [$isV6LocalStatePresent] or V6.3 ls [$isV6LocalStatePresent2]
isRequireNewConsentData [$isRequireNewConsentData]
shouldCallConsentStatus[$res]
""".trimIndent()
)

return res
}
override val requiresNewConsentData: Boolean
get() = dataStorage.localDataVersion < DataStorage.HARDCODED_LOCAL_DATA_VERSION

override var gdprMessageMetaData: MessageMetaData?
get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private class ServiceImpl(
}
.executeOnRight { metaDataResponse -> handleMetaDataResponse(metaDataResponse) }

if (messageReq.authId != null || campaignManager.shouldCallConsentStatus || campaignManager.requiresNewConsentData) {
if (messageReq.authId != null || campaignManager.shouldCallConsentStatus) {
triggerConsentStatus(messageReq)
.executeOnLeft { consentStatusError ->
onFailure(consentStatusError, true)
Expand Down

0 comments on commit 4c8fd31

Please sign in to comment.