diff --git a/code/core/api/core.api b/code/core/api/core.api index b26f1cf47..bc90e80ca 100644 --- a/code/core/api/core.api +++ b/code/core/api/core.api @@ -10,6 +10,10 @@ public class com/adobe/marketing/mobile/AdobeError : java/io/Serializable { public static final field CALLBACK_NULL Lcom/adobe/marketing/mobile/AdobeError; public static final field CALLBACK_TIMEOUT Lcom/adobe/marketing/mobile/AdobeError; public static final field EXTENSION_NOT_INITIALIZED Lcom/adobe/marketing/mobile/AdobeError; + public static final field INVALID_REQUEST Lcom/adobe/marketing/mobile/AdobeError; + public static final field INVALID_RESPONSE Lcom/adobe/marketing/mobile/AdobeError; + public static final field NETWORK_ERROR Lcom/adobe/marketing/mobile/AdobeError; + public static final field SERVER_ERROR Lcom/adobe/marketing/mobile/AdobeError; public static final field UNEXPECTED_ERROR Lcom/adobe/marketing/mobile/AdobeError; protected fun (Ljava/lang/String;I)V public fun getErrorCode ()I @@ -891,6 +895,11 @@ public abstract class com/adobe/marketing/mobile/services/ui/ShowFailed : com/ad public final fun getReason ()Ljava/lang/String; } +public final class com/adobe/marketing/mobile/services/ui/SuppressedByAppDeveloper : com/adobe/marketing/mobile/services/ui/ShowFailed { + public static final field $stable I + public static final field INSTANCE Lcom/adobe/marketing/mobile/services/ui/SuppressedByAppDeveloper; +} + public abstract interface class com/adobe/marketing/mobile/services/ui/UIService { public abstract fun create (Lcom/adobe/marketing/mobile/services/ui/Presentation;Lcom/adobe/marketing/mobile/services/ui/PresentationUtilityProvider;)Lcom/adobe/marketing/mobile/services/ui/Presentable; public abstract fun setPresentationDelegate (Lcom/adobe/marketing/mobile/services/ui/PresentationDelegate;)V diff --git a/code/core/src/main/java/com/adobe/marketing/mobile/AdobeError.java b/code/core/src/main/java/com/adobe/marketing/mobile/AdobeError.java index dbb4e9402..bd44940b6 100644 --- a/code/core/src/main/java/com/adobe/marketing/mobile/AdobeError.java +++ b/code/core/src/main/java/com/adobe/marketing/mobile/AdobeError.java @@ -27,6 +27,18 @@ public class AdobeError implements Serializable { /** when a callback is null. */ public static final AdobeError CALLBACK_NULL = new AdobeError("general.callback.null", 2); + /** when a server error happens. */ + public static final AdobeError SERVER_ERROR = new AdobeError("general.server.error", 4); + + /** when a network error happens. */ + public static final AdobeError NETWORK_ERROR = new AdobeError("general.network.error", 5); + + /** when an invalid request is made. */ + public static final AdobeError INVALID_REQUEST = new AdobeError("general.request.invalid", 6); + + /** when an invalid response is received. */ + public static final AdobeError INVALID_RESPONSE = new AdobeError("general.response.invalid", 7); + /** when a extension is not initialized. */ public static final AdobeError EXTENSION_NOT_INITIALIZED = new AdobeError("general.extension.not.initialized", 11); diff --git a/code/core/src/main/java/com/adobe/marketing/mobile/internal/CoreConstants.kt b/code/core/src/main/java/com/adobe/marketing/mobile/internal/CoreConstants.kt index fedd11f15..680ef9534 100644 --- a/code/core/src/main/java/com/adobe/marketing/mobile/internal/CoreConstants.kt +++ b/code/core/src/main/java/com/adobe/marketing/mobile/internal/CoreConstants.kt @@ -13,7 +13,7 @@ package com.adobe.marketing.mobile.internal internal object CoreConstants { const val LOG_TAG = "MobileCore" - const val VERSION = "3.1.2" + const val VERSION = "3.2.0" object EventDataKeys { /** diff --git a/code/core/src/main/java/com/adobe/marketing/mobile/services/ui/Presentation.kt b/code/core/src/main/java/com/adobe/marketing/mobile/services/ui/Presentation.kt index 2ed176017..c46f87127 100644 --- a/code/core/src/main/java/com/adobe/marketing/mobile/services/ui/Presentation.kt +++ b/code/core/src/main/java/com/adobe/marketing/mobile/services/ui/Presentation.kt @@ -37,7 +37,7 @@ sealed class Presentation>(val listener: PresentationEventLi /** * Represents an InAppMessage presentation. * @param settings the settings for the InAppMessage - * @param eventListener the listener for the getting notified about InAppMessage lifecycle events + * @param eventListener the listener for getting notifications about InAppMessage lifecycle events * @param eventHandler the event handler performing operations on the InAppMessage */ class InAppMessage( @@ -54,7 +54,7 @@ class InAppMessage( /** * Represents a FloatingButton presentation. - * @param eventListener the listener for the getting notified about FloatingButton lifecycle events + * @param eventListener the listener for getting notifications about FloatingButton lifecycle events * @param settings the settings for the FloatingButton */ class FloatingButton( @@ -72,7 +72,7 @@ class FloatingButton( /** * Represents an Alert presentation. * @param settings the settings for the Alert - * @param eventListener the listener for the getting notified about Alert lifecycle events + * @param eventListener the listener for getting notifications about Alert lifecycle events */ class Alert( val settings: AlertSettings, diff --git a/code/core/src/main/java/com/adobe/marketing/mobile/services/ui/PresentationError.kt b/code/core/src/main/java/com/adobe/marketing/mobile/services/ui/PresentationError.kt index a1c9caf0f..03964a498 100644 --- a/code/core/src/main/java/com/adobe/marketing/mobile/services/ui/PresentationError.kt +++ b/code/core/src/main/java/com/adobe/marketing/mobile/services/ui/PresentationError.kt @@ -27,7 +27,7 @@ sealed class DismissFailed(val reason: String) : PresentationError /** * Represents a failure to show a Presentable because a conflicting presentation is already shown. */ -object ConflictingPresentation : ShowFailed("Conflicting presentation is visible.") +object ConflictingPresentation : ShowFailed("Conflict") /** * Represents a failure to show a Presentable because there is no activity to show it on. @@ -37,8 +37,14 @@ object NoAttachableActivity : ShowFailed("No attachable activity available.") /** * Represents a failure to show a Presentable because the delegate gate was not met. */ +@Deprecated("Use SuppressedByAppDeveloper instead", ReplaceWith("SuppressedByAppDeveloper")) object DelegateGateNotMet : ShowFailed("PresentationDelegate suppressed the presentation from being shown.") +/** + * Represents a failure to show a Presentable because the app developer has suppressed [Presentable]s. + */ +object SuppressedByAppDeveloper : ShowFailed("SuppressedByAppDeveloper") + /** * Represents a failure to show a Presentable because it is already shown. */ diff --git a/code/core/src/phone/java/com/adobe/marketing/mobile/services/ui/common/AEPPresentable.kt b/code/core/src/phone/java/com/adobe/marketing/mobile/services/ui/common/AEPPresentable.kt index 8de958236..034c146b6 100644 --- a/code/core/src/phone/java/com/adobe/marketing/mobile/services/ui/common/AEPPresentable.kt +++ b/code/core/src/phone/java/com/adobe/marketing/mobile/services/ui/common/AEPPresentable.kt @@ -25,13 +25,13 @@ import com.adobe.marketing.mobile.services.ui.AlreadyDismissed import com.adobe.marketing.mobile.services.ui.AlreadyHidden import com.adobe.marketing.mobile.services.ui.AlreadyShown import com.adobe.marketing.mobile.services.ui.ConflictingPresentation -import com.adobe.marketing.mobile.services.ui.DelegateGateNotMet import com.adobe.marketing.mobile.services.ui.NoActivityToDetachFrom import com.adobe.marketing.mobile.services.ui.NoAttachableActivity import com.adobe.marketing.mobile.services.ui.Presentable import com.adobe.marketing.mobile.services.ui.Presentation import com.adobe.marketing.mobile.services.ui.PresentationDelegate import com.adobe.marketing.mobile.services.ui.PresentationUtilityProvider +import com.adobe.marketing.mobile.services.ui.SuppressedByAppDeveloper import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import java.lang.ref.WeakReference @@ -158,7 +158,8 @@ internal abstract class AEPPresentable> : if (gateDisplay()) { val canShow = (presentationDelegate?.canShow(this@AEPPresentable) ?: true) if (!canShow) { - presentation.listener.onError(this@AEPPresentable, DelegateGateNotMet) + Log.debug(ServiceConstants.LOG_TAG, LOG_SOURCE, "Presentable couldn't be displayed, PresentationDelegate#canShow states the presentable should not be displayed.") + presentation.listener.onError(this@AEPPresentable, SuppressedByAppDeveloper) return@launch } } diff --git a/code/core/src/phone/java/com/adobe/marketing/mobile/services/ui/message/DefaultInAppMessageEventHandler.kt b/code/core/src/phone/java/com/adobe/marketing/mobile/services/ui/message/DefaultInAppMessageEventHandler.kt index 44c051a99..b25c123d2 100644 --- a/code/core/src/phone/java/com/adobe/marketing/mobile/services/ui/message/DefaultInAppMessageEventHandler.kt +++ b/code/core/src/phone/java/com/adobe/marketing/mobile/services/ui/message/DefaultInAppMessageEventHandler.kt @@ -19,7 +19,6 @@ import com.adobe.marketing.mobile.AdobeCallback import com.adobe.marketing.mobile.services.Log import com.adobe.marketing.mobile.services.ServiceConstants import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.cancelChildren import kotlinx.coroutines.launch import java.io.UnsupportedEncodingException import java.lang.ref.WeakReference @@ -119,7 +118,6 @@ internal class DefaultInAppMessageEventHandler internal constructor( @MainThread internal fun onNewWebView(webView: WebView?) { Log.debug(ServiceConstants.LOG_TAG, LOG_SOURCE, "Internal web view was reset.") - mainScope.coroutineContext.cancelChildren() webView?.let { this@DefaultInAppMessageEventHandler.webView = WeakReference(it) diff --git a/code/core/src/test/java/com/adobe/marketing/mobile/services/ui/common/AEPPresentableTest.kt b/code/core/src/test/java/com/adobe/marketing/mobile/services/ui/common/AEPPresentableTest.kt index 70fb71d2c..3210f9fa6 100644 --- a/code/core/src/test/java/com/adobe/marketing/mobile/services/ui/common/AEPPresentableTest.kt +++ b/code/core/src/test/java/com/adobe/marketing/mobile/services/ui/common/AEPPresentableTest.kt @@ -21,7 +21,6 @@ import com.adobe.marketing.mobile.services.ui.Alert import com.adobe.marketing.mobile.services.ui.AlreadyDismissed import com.adobe.marketing.mobile.services.ui.AlreadyHidden import com.adobe.marketing.mobile.services.ui.AlreadyShown -import com.adobe.marketing.mobile.services.ui.DelegateGateNotMet import com.adobe.marketing.mobile.services.ui.FloatingButton import com.adobe.marketing.mobile.services.ui.InAppMessage import com.adobe.marketing.mobile.services.ui.NoActivityToDetachFrom @@ -29,6 +28,7 @@ import com.adobe.marketing.mobile.services.ui.Presentable import com.adobe.marketing.mobile.services.ui.Presentation import com.adobe.marketing.mobile.services.ui.PresentationDelegate import com.adobe.marketing.mobile.services.ui.PresentationUtilityProvider +import com.adobe.marketing.mobile.services.ui.SuppressedByAppDeveloper import com.adobe.marketing.mobile.services.ui.message.InAppMessageEventListener import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -175,7 +175,7 @@ internal class AEPPresentableTest { verify(mockPresentationDelegate).canShow(aepPresentableWithGatedDisplay) // verify that the listener is notified of the error - verify(mockPresentationListener).onError(aepPresentableWithGatedDisplay, DelegateGateNotMet) + verify(mockPresentationListener).onError(aepPresentableWithGatedDisplay, SuppressedByAppDeveloper) // verify that the lifecycle provider is called to register the listener verify(mockAppLifecycleProvider, never()).registerListener( diff --git a/code/gradle.properties b/code/gradle.properties index f742c47d5..f6e4d6d5a 100644 --- a/code/gradle.properties +++ b/code/gradle.properties @@ -5,7 +5,7 @@ android.useAndroidX=true #Maven artifacts #Core extension -coreExtensionVersion=3.1.2 +coreExtensionVersion=3.2.0 coreExtensionName=core coreMavenRepoName=AdobeMobileCoreSdk coreMavenRepoDescription=Android Core Extension for Adobe Mobile Marketing