Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
carmelo-iriti committed Oct 11, 2023
1 parent 180e062 commit 32701c3
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -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<Boolean>("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()


}
return mockObject ?: ConnectionManager.create(appCtx)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx)
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -97,5 +95,3 @@ fun makeConsentLib(
connectionManager = connManager,
)
}


Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx)
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
}

Expand Down

0 comments on commit 32701c3

Please sign in to comment.