/** * Unregisters the in-app message manager. * * @param activity The current Activity. */ public void unregisterInAppMessageManager(Activity activity) { AppboyLogger.d(TAG, "unregisterInAppMessageManager called"); // If there is an in-app message being displayed when the host app transitions to another // Activity (or // requests an orientation change), we save it in memory so that we can redisplay it when the // operation is done. if (mInAppMessageViewWrapper != null) { ViewUtils.removeViewFromParent(mInAppMessageViewWrapper.getInAppMessageView()); // Only continue if we're not animating a close if (mInAppMessageViewWrapper.getIsAnimatingClose()) { mInAppMessageViewLifecycleListener.afterClosed(mInAppMessageViewWrapper.getInAppMessage()); mCarryoverInAppMessage = null; } else { mCarryoverInAppMessage = mInAppMessageViewWrapper.getInAppMessage(); } mInAppMessageViewWrapper = null; } else { mCarryoverInAppMessage = null; } mActivity = null; mDisplayingInAppMessage.set(false); }
/** * Hides any currently displaying in-app message. Note that in-app message animation is * configurable on the in-app message model itself and should be configured there. * * @param dismissed whether the message was dismissed by the user. If dismissed is true, * IInAppMessageViewLifecycleListener.onDismissed() will be called on the current * IInAppMessageViewLifecycleListener. */ public void hideCurrentlyDisplayingInAppMessage(boolean dismissed) { IInAppMessageViewWrapper inAppMessageWrapperView = mInAppMessageViewWrapper; if (inAppMessageWrapperView != null) { if (dismissed) { mInAppMessageViewLifecycleListener.onDismissed( inAppMessageWrapperView.getInAppMessageView(), inAppMessageWrapperView.getInAppMessage()); } inAppMessageWrapperView.close(); } }