Skip to content

Commit

Permalink
Merge pull request #717 from adobe/staging
Browse files Browse the repository at this point in the history
staging -> main (core-v3.2.0)
  • Loading branch information
praveek authored Oct 1, 2024
2 parents 882669b + 78b9713 commit d3e61e6
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 12 deletions.
9 changes: 9 additions & 0 deletions code/core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init> (Ljava/lang/String;I)V
public fun getErrorCode ()I
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions code/core/src/main/java/com/adobe/marketing/mobile/AdobeError.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ sealed class Presentation<T : Presentation<T>>(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(
Expand All @@ -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(
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -158,7 +158,8 @@ internal abstract class AEPPresentable<T : Presentation<T>> :
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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ 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
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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion code/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d3e61e6

Please sign in to comment.