/**
   * Unregisters the slideup manager.
   *
   * @param activity The current Activity.
   */
  public void unregisterSlideupManager(Activity activity) {
    // If there is slideup 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 (mSlideupViewWrapper != null) {

      ViewUtils.removeViewFromParent(mSlideupViewWrapper.getSlideupView());
      // Only continue if we're not animating a close
      if (mSlideupViewWrapper.getIsAnimatingClose()) {
        mSlideupViewWrapper.callAfterClosed();
        mCarryoverSlideup = null;
      } else {
        mCarryoverSlideup = mSlideupViewWrapper.getSlideup();
      }

      mSlideupViewWrapper = null;
    } else {
      mCarryoverSlideup = null;
    }

    // Slideup subscriptions are per Activity, so we must remove the subscriber when the host app
    // unregisters the slideup manager.
    Appboy.getInstance(activity)
        .removeSingleSubscription(mSlideupEventSubscriber, SlideupEvent.class);
  }
 /**
  * Ensures the InAppMessageManager is subscribed in-app message events if not already subscribed.
  * Before this method gets called, the InAppMessageManager is not subscribed to in-app message
  * events and cannot display them. Every call to registerInAppMessageManager() calls this method.
  *
  * <p>If events with triggers are logged before the first call to registerInAppMessageManager(),
  * then the corresponding in-app message won't display. Thus, if logging events with triggers
  * before the first call to registerInAppMessageManager(), then call this method to ensure that
  * in-app message events are correctly handled by the AppboyInAppMessageManager.
  *
  * <p>For example, if logging custom events with triggers in your first activity's onCreate(), be
  * sure to call this method manually beforehand so that the in-app message will get displayed by
  * the time registerInAppMessageManager() gets called.
  *
  * @param context The application context
  */
 public void ensureSubscribedToInAppMessageEvents(Context context) {
   if (mInAppMessageEventSubscriber == null) {
     AppboyLogger.d(TAG, "Subscribing in-app message event subscriber");
     mInAppMessageEventSubscriber = createInAppMessageEventSubscriber();
     Appboy.getInstance(context).subscribeToNewInAppMessages(mInAppMessageEventSubscriber);
   }
 }
  /**
   * Registers the slideup manager, which will listen to and display incoming slideup messages. The
   * current Activity is required in order to properly inflate and display the slideup view.
   *
   * <p>Important note: Every Activity must call registerSlideupManager in the onResume lifecycle
   * method, otherwise slideup messages may be lost!
   *
   * @param activity The current Activity.
   */
  public void registerSlideupManager(Activity activity) {
    // We need the current Activity so that we can inflate or programmatically create the slideup
    // View for each Activity. We cannot share the View because doing so would create a memory leak.
    mActivity = activity;

    // We have a special check to see if the host app switched to a different Activity (or recreated
    // the same Activity during an orientation change) so that we can redisplay the slideup.
    if (mCarryoverSlideup != null) {
      mCarryoverSlideup.setAnimateIn(false);
      displaySlideup(mCarryoverSlideup);
      mCarryoverSlideup = null;
    }

    // Every time the AppboySlideupManager is registered to an Activity, we add a slideup subscriber
    // which listens to new slideups, adds it to the stack, and displays it if it can.
    mSlideupEventSubscriber = createSlideupEventSubscriber();
    Appboy.getInstance(activity).subscribeToNewSlideups(mSlideupEventSubscriber);
  }
 private IAppboyNavigator getAppboyNavigator() {
   IAppboyNavigator customAppboyNavigator = Appboy.getInstance(mActivity).getAppboyNavigator();
   return customAppboyNavigator != null ? customAppboyNavigator : mDefaultAppboyNavigator;
 }