diff --git a/emarsys-sdk/src/androidTest/java/com/emarsys/EmarsysTest.kt b/emarsys-sdk/src/androidTest/java/com/emarsys/EmarsysTest.kt index ca76c615..c309914c 100644 --- a/emarsys-sdk/src/androidTest/java/com/emarsys/EmarsysTest.kt +++ b/emarsys-sdk/src/androidTest/java/com/emarsys/EmarsysTest.kt @@ -88,7 +88,6 @@ import io.mockk.spyk import io.mockk.verify import io.mockk.verifyOrder import org.junit.Rule -import org.mockito.kotlin.mock import java.util.concurrent.CountDownLatch class EmarsysTest : AnnotationSpec() { @@ -876,7 +875,6 @@ class EmarsysTest : AnnotationSpec() { runBlockingOnCoreSdkThread { verify { mockMobileEngageApi.clearContact(completionListener) - mockPredictRestricted.clearVisitorId() } } } @@ -891,7 +889,6 @@ class EmarsysTest : AnnotationSpec() { } verify { mockLoggingMobileEngageApi.clearContact(completionListener) - mockLoggingPredictRestricted.clearVisitorId() } } diff --git a/emarsys-sdk/src/androidTest/java/com/emarsys/predict/PredictRestrictedTest.kt b/emarsys-sdk/src/androidTest/java/com/emarsys/predict/PredictRestrictedTest.kt index e69ee0bb..d56c9495 100644 --- a/emarsys-sdk/src/androidTest/java/com/emarsys/predict/PredictRestrictedTest.kt +++ b/emarsys-sdk/src/androidTest/java/com/emarsys/predict/PredictRestrictedTest.kt @@ -48,12 +48,6 @@ class PredictRestrictedTest : AnnotationSpec() { Mockito.verify(mockPredictInternal).setContact(CONTACT_FIELD_ID, "contactId", null) } - @Test - fun testPredict_clearContact_delegatesTo_Predict_Internal() { - predictRestricted.clearVisitorId() - Mockito.verify(mockPredictInternal).clearVisitorId() - } - @Test fun testPredict_clearPredictOnlyContact_delegatesTo_Predict_Internal() { val mockCompletionListener = mock() diff --git a/emarsys-sdk/src/main/java/com/emarsys/Emarsys.kt b/emarsys-sdk/src/main/java/com/emarsys/Emarsys.kt index ea2148ff..f735144a 100644 --- a/emarsys-sdk/src/main/java/com/emarsys/Emarsys.kt +++ b/emarsys-sdk/src/main/java/com/emarsys/Emarsys.kt @@ -181,9 +181,6 @@ object Emarsys { EmarsysDependencyInjection.mobileEngageApi() .proxyApi(mobileEngage().concurrentHandlerHolder) .clearContact(completionListener) - EmarsysDependencyInjection.predictRestrictedApi() - .proxyApi(mobileEngage().concurrentHandlerHolder) - .clearVisitorId() } private fun clearPredictOnlyContact(completionListener: CompletionListener?) { diff --git a/emarsys-sdk/src/main/java/com/emarsys/predict/PredictRestricted.kt b/emarsys-sdk/src/main/java/com/emarsys/predict/PredictRestricted.kt index 86ea785d..adb5150e 100644 --- a/emarsys-sdk/src/main/java/com/emarsys/predict/PredictRestricted.kt +++ b/emarsys-sdk/src/main/java/com/emarsys/predict/PredictRestricted.kt @@ -15,9 +15,4 @@ class PredictRestricted(private val loggingInstance: Boolean = false) : PredictR (if (loggingInstance) predict().loggingPredictInternal else predict().predictInternal) .clearPredictOnlyContact(completionListener) } - - override fun clearVisitorId() { - (if (loggingInstance) predict().loggingPredictInternal else predict().predictInternal) - .clearVisitorId() - } } \ No newline at end of file diff --git a/emarsys-sdk/src/main/java/com/emarsys/predict/PredictRestrictedApi.kt b/emarsys-sdk/src/main/java/com/emarsys/predict/PredictRestrictedApi.kt index bb76f598..3fbe14b3 100644 --- a/emarsys-sdk/src/main/java/com/emarsys/predict/PredictRestrictedApi.kt +++ b/emarsys-sdk/src/main/java/com/emarsys/predict/PredictRestrictedApi.kt @@ -7,6 +7,4 @@ interface PredictRestrictedApi { fun setContact(contactFieldId: Int, contactFieldValue: String, completionListener: CompletionListener?) fun clearPredictOnlyContact(completionListener: CompletionListener?) - - fun clearVisitorId() } \ No newline at end of file diff --git a/emarsys/src/androidTest/java/com/emarsys/config/DefaultConfigInternalTest.kt b/emarsys/src/androidTest/java/com/emarsys/config/DefaultConfigInternalTest.kt index d489f605..ee901178 100644 --- a/emarsys/src/androidTest/java/com/emarsys/config/DefaultConfigInternalTest.kt +++ b/emarsys/src/androidTest/java/com/emarsys/config/DefaultConfigInternalTest.kt @@ -620,7 +620,6 @@ class DefaultConfigInternalTest : AnnotationSpec() { FeatureRegistry.isFeatureEnabled(InnerFeature.PREDICT) shouldBe true verify(mockMobileEngageInternal).clearContact(null) - verify(mockPredictInternal).clearVisitorId() } @Test diff --git a/emarsys/src/main/java/com/emarsys/config/DefaultConfigInternal.kt b/emarsys/src/main/java/com/emarsys/config/DefaultConfigInternal.kt index d6bf62ff..ffb1aed8 100644 --- a/emarsys/src/main/java/com/emarsys/config/DefaultConfigInternal.kt +++ b/emarsys/src/main/java/com/emarsys/config/DefaultConfigInternal.kt @@ -159,7 +159,6 @@ class DefaultConfigInternal( override fun changeMerchantId(merchantId: String?, completionListener: CompletionListener?) { if (FeatureRegistry.isFeatureEnabled(InnerFeature.MOBILE_ENGAGE)) { mobileEngageInternal.clearContact(null) - predictInternal.clearVisitorId() } else if (FeatureRegistry.isFeatureEnabled(InnerFeature.PREDICT)) { predictInternal.clearPredictOnlyContact(null) } diff --git a/predict/src/androidTest/java/com/emarsys/predict/DefaultPredictInternalTest.kt b/predict/src/androidTest/java/com/emarsys/predict/DefaultPredictInternalTest.kt index 2e17e687..30f01b48 100644 --- a/predict/src/androidTest/java/com/emarsys/predict/DefaultPredictInternalTest.kt +++ b/predict/src/androidTest/java/com/emarsys/predict/DefaultPredictInternalTest.kt @@ -205,14 +205,7 @@ class DefaultPredictInternalTest : AnnotationSpec() { } @Test - fun testClearContact_shouldRemove_visitorIdFromKeyValueStore() { - predictInternal.clearVisitorId() - - verify(mockKeyValueStore).remove("predict_visitor_id") - } - - @Test - fun testClearPredictOnlyContact_shouldCall_requestManager() { + fun testClearPredictOnlyContact_shouldCall_requestManager_andShouldNotRemoveVisitorId() { whenever( mockPredictMultiIdRequestModelFactory.createClearContactRequestModel() ).thenReturn(mockRequestModel) @@ -220,6 +213,7 @@ class DefaultPredictInternalTest : AnnotationSpec() { predictInternal.clearPredictOnlyContact(mockCompletionListener) verify(mockRequestManager).submit(mockRequestModel, mockCompletionListener) + verifyNoInteractions(mockKeyValueStore) } @Test @@ -250,13 +244,6 @@ class DefaultPredictInternalTest : AnnotationSpec() { verifyNoInteractions(mockCompletionListener) } - @Test - fun testClearPredictOnlyContact_shouldRemove_visitorIdFromKeyValueStore() { - predictInternal.clearPredictOnlyContact(mockCompletionListener) - - verify(mockKeyValueStore).remove("predict_visitor_id") - } - @Test fun testTrackCart_returnsShardId() { predictInternal.trackCart(listOf()) shouldBe ID1 diff --git a/predict/src/main/java/com/emarsys/predict/DefaultPredictInternal.kt b/predict/src/main/java/com/emarsys/predict/DefaultPredictInternal.kt index 6f210cba..3ee582e9 100644 --- a/predict/src/main/java/com/emarsys/predict/DefaultPredictInternal.kt +++ b/predict/src/main/java/com/emarsys/predict/DefaultPredictInternal.kt @@ -13,7 +13,6 @@ import com.emarsys.core.provider.uuid.UUIDProvider import com.emarsys.core.request.RequestManager import com.emarsys.core.response.ResponseModel import com.emarsys.core.shard.ShardModel -import com.emarsys.core.storage.KeyValueStore import com.emarsys.core.util.Assert import com.emarsys.core.util.JsonUtils.fromMap import com.emarsys.predict.api.model.CartItem @@ -50,7 +49,6 @@ class DefaultPredictInternal( private val uuidProvider: UUIDProvider = requestContext.uuidProvider private val timestampProvider: TimestampProvider = requestContext.timestampProvider - private val keyValueStore: KeyValueStore = requestContext.keyValueStore override fun setContact( contactFieldId: Int, @@ -73,17 +71,11 @@ class DefaultPredictInternal( try { val requestModel = predictMultiIdRequestModelFactory.createClearContactRequestModel() requestManager.submit(requestModel, completionListener) - - keyValueStore.remove(VISITOR_ID_KEY) } catch (e: Exception) { completionListener?.onCompleted(e) } } - override fun clearVisitorId() { - keyValueStore.remove(VISITOR_ID_KEY) - } - override fun trackCart(items: List): String { val shard = ShardModel.Builder(timestampProvider, uuidProvider) .type(TYPE_CART) diff --git a/predict/src/main/java/com/emarsys/predict/LoggingPredictInternal.kt b/predict/src/main/java/com/emarsys/predict/LoggingPredictInternal.kt index fb2f9186..0b6c5fd8 100644 --- a/predict/src/main/java/com/emarsys/predict/LoggingPredictInternal.kt +++ b/predict/src/main/java/com/emarsys/predict/LoggingPredictInternal.kt @@ -34,11 +34,6 @@ class LoggingPredictInternal(private val klass: Class<*>) : PredictInternal { debug(MethodNotAllowed(klass, callerMethodName, parameters)) } - override fun clearVisitorId() { - val callerMethodName = SystemUtils.getCallerMethodName() - debug(MethodNotAllowed(klass, callerMethodName, null)) - } - override fun trackCart(items: List): String { val parameters: Map = mapOf( "items" to items.toString() diff --git a/predict/src/main/java/com/emarsys/predict/PredictInternal.kt b/predict/src/main/java/com/emarsys/predict/PredictInternal.kt index a7f1c97b..3cc222aa 100644 --- a/predict/src/main/java/com/emarsys/predict/PredictInternal.kt +++ b/predict/src/main/java/com/emarsys/predict/PredictInternal.kt @@ -11,7 +11,6 @@ import com.emarsys.predict.api.model.RecommendationFilter interface PredictInternal { fun setContact(contactFieldId: Int, contactFieldValue: String, completionListener: CompletionListener?) fun clearPredictOnlyContact(completionListener: CompletionListener?) - fun clearVisitorId() fun trackCart(items: List): String fun trackPurchase(orderId: String, items: List): String fun trackItemView(itemId: String): String