diff --git a/cmplibrary/src/debug/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt b/cmplibrary/src/debug/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt index 402822c60..be73d0ae2 100644 --- a/cmplibrary/src/debug/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt +++ b/cmplibrary/src/debug/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt @@ -1,24 +1,31 @@ package com.sourcepoint.cmplibrary.creation import android.content.Context -import com.sourcepoint.cmplibrary.SpDiagnosticImpl +import android.preference.PreferenceManager +import com.sourcepoint.cmplibrary.core.getOrNull import com.sourcepoint.cmplibrary.data.network.connection.ConnectionManager import com.sourcepoint.cmplibrary.data.network.connection.create internal fun getConnectionManager(appCtx: Context): ConnectionManager { - val mockObject: ConnectionManager? = SpDiagnosticImpl.fetch("connectionTest") - ?.let { - object : ConnectionManager { - override val isConnected: Boolean - get() { - Thread.sleep(1000) - return it - } - } - } + Thread.sleep(300) - return mockObject ?: ConnectionManager.create(appCtx) + val mockObject: ConnectionManager? = com.sourcepoint.cmplibrary.util.check { + PreferenceManager.getDefaultSharedPreferences(appCtx).all + .toList() + .find { it.first == "connectionTest" } + ?.let { it.second as? Boolean } + ?.let { + object : ConnectionManager { + override val isConnected: Boolean + get() { + Thread.sleep(400) + return it + } + } + } + }.getOrNull() -} \ No newline at end of file + return mockObject ?: ConnectionManager.create(appCtx) +} diff --git a/cmplibrary/src/localProd/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt b/cmplibrary/src/localProd/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt index 271290c12..baa22d507 100644 --- a/cmplibrary/src/localProd/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt +++ b/cmplibrary/src/localProd/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt @@ -4,4 +4,4 @@ import android.content.Context import com.sourcepoint.cmplibrary.data.network.connection.ConnectionManager import com.sourcepoint.cmplibrary.data.network.connection.create -internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx) \ No newline at end of file +internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx) diff --git a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/consent/ConsentManager.kt b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/consent/ConsentManager.kt index ee6a601f1..22e879afc 100644 --- a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/consent/ConsentManager.kt +++ b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/consent/ConsentManager.kt @@ -86,9 +86,7 @@ private class ConsentManagerImpl( override val storedConsent: Boolean get() { return dataStorage.ccpaConsentStatus != null || - dataStorage.gdprConsentStatus != null || - dataStorage.getCcpaConsentResp() != null || - dataStorage.consentStatus != null + dataStorage.gdprConsentStatus != null } override fun enqueueConsent(consentActionImpl: ConsentActionImpl) { diff --git a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/creation/Factory.kt b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/creation/Factory.kt index 04408a0ed..a38efe8ee 100644 --- a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/creation/Factory.kt +++ b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/creation/Factory.kt @@ -20,8 +20,6 @@ import com.sourcepoint.cmplibrary.data.local.DataStorage import com.sourcepoint.cmplibrary.data.local.DataStorageCcpa import com.sourcepoint.cmplibrary.data.local.DataStorageGdpr import com.sourcepoint.cmplibrary.data.local.create -import com.sourcepoint.cmplibrary.data.network.connection.ConnectionManager -import com.sourcepoint.cmplibrary.data.network.connection.create import com.sourcepoint.cmplibrary.data.network.converter.JsonConverter import com.sourcepoint.cmplibrary.data.network.converter.create import com.sourcepoint.cmplibrary.data.network.util.* //ktlint-disable @@ -97,5 +95,3 @@ fun makeConsentLib( connectionManager = connManager, ) } - - diff --git a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/creation/SpConfigDataBuilder.kt b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/creation/SpConfigDataBuilder.kt index dfe836a27..6ae16977d 100644 --- a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/creation/SpConfigDataBuilder.kt +++ b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/creation/SpConfigDataBuilder.kt @@ -1,8 +1,5 @@ package com.sourcepoint.cmplibrary.creation -import com.example.cmplibrary.BuildConfig -import com.sourcepoint.cmplibrary.Diagnostic -import com.sourcepoint.cmplibrary.SpDiagnosticImpl import com.sourcepoint.cmplibrary.data.network.util.CampaignsEnv import com.sourcepoint.cmplibrary.exception.CampaignType import com.sourcepoint.cmplibrary.exception.Logger @@ -41,10 +38,6 @@ class SpConfigDataBuilder { campaigns.add(SpCampaign(this.first, this.second.map { it.toTParam() })) } - operator fun Diagnostic.unaryPlus() { - if (BuildConfig.DEBUG) SpDiagnosticImpl.fetchOrStore(key, block) - } - fun addAccountId(accountId: Int): SpConfigDataBuilder = apply { this.accountId = accountId } diff --git a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/model/exposed/SpConfig.kt b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/model/exposed/SpConfig.kt index a6b6c4df5..b37784b61 100644 --- a/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/model/exposed/SpConfig.kt +++ b/cmplibrary/src/main/java/com/sourcepoint/cmplibrary/model/exposed/SpConfig.kt @@ -1,7 +1,6 @@ package com.sourcepoint.cmplibrary.model.exposed import com.sourcepoint.cmplibrary.data.network.DEFAULT_TIMEOUT -import com.sourcepoint.cmplibrary.data.network.connection.ConnectionManager import com.sourcepoint.cmplibrary.data.network.util.CampaignsEnv import com.sourcepoint.cmplibrary.exception.CampaignType import com.sourcepoint.cmplibrary.exception.Logger diff --git a/cmplibrary/src/preprod/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt b/cmplibrary/src/preprod/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt index 271290c12..baa22d507 100644 --- a/cmplibrary/src/preprod/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt +++ b/cmplibrary/src/preprod/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt @@ -4,4 +4,4 @@ import android.content.Context import com.sourcepoint.cmplibrary.data.network.connection.ConnectionManager import com.sourcepoint.cmplibrary.data.network.connection.create -internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx) \ No newline at end of file +internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx) diff --git a/cmplibrary/src/release/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt b/cmplibrary/src/release/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt index 271290c12..baa22d507 100644 --- a/cmplibrary/src/release/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt +++ b/cmplibrary/src/release/java/com/sourcepoint/cmplibrary/creation/ComponentFactory.kt @@ -4,4 +4,4 @@ import android.content.Context import com.sourcepoint.cmplibrary.data.network.connection.ConnectionManager import com.sourcepoint.cmplibrary.data.network.connection.create -internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx) \ No newline at end of file +internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx) diff --git a/samples/app/src/main/java/com/sourcepoint/app/v6/di/AppModule.kt b/samples/app/src/main/java/com/sourcepoint/app/v6/di/AppModule.kt index afbbd3d37..8e33cd686 100644 --- a/samples/app/src/main/java/com/sourcepoint/app/v6/di/AppModule.kt +++ b/samples/app/src/main/java/com/sourcepoint/app/v6/di/AppModule.kt @@ -39,7 +39,8 @@ val appModule = module { customVendorList = customVendorDataList, customCategories = customCategoriesData, useGdprGroupPmIfAvailable = false, - authId = null //get(qualifier = named("authId"))) + authId = null, //get(qualifier = named("authId"))) + diagnostic = emptyList() ) }