Class SwrveBaseCampaign

java.lang.Object
com.swrve.sdk.messaging.SwrveBaseCampaign
Direct Known Subclasses:
SwrveConversationCampaign, SwrveEmbeddedCampaign, SwrveInAppCampaign

public abstract class SwrveBaseCampaign extends Object
  • Field Details

    • DEFAULT_DELAY_FIRST_MESSAGE

      protected static int DEFAULT_DELAY_FIRST_MESSAGE
    • DEFAULT_MAX_IMPRESSIONS

      protected static int DEFAULT_MAX_IMPRESSIONS
    • DEFAULT_MIN_DELAY_BETWEEN_MSGS

      protected static int DEFAULT_MIN_DELAY_BETWEEN_MSGS
    • campaignManager

      protected ISwrveCampaignManager campaignManager
    • campaignDisplayer

      protected SwrveCampaignDisplayer campaignDisplayer
    • id

      protected int id
    • saveableState

      protected SwrveCampaignState saveableState
    • startDate

      protected Date startDate
    • endDate

      protected Date endDate
    • triggers

      protected List<Trigger> triggers
    • messageCenter

      protected boolean messageCenter
    • subject

      protected String subject
    • priority

      protected int priority
    • maxImpressions

      protected int maxImpressions
    • minDelayBetweenMessage

      protected int minDelayBetweenMessage
    • showMessagesAfterLaunch

      protected Date showMessagesAfterLaunch
    • name

      protected String name
    • messageCenterDetails

      protected SwrveMessageCenterDetails messageCenterDetails
  • Constructor Details

    • SwrveBaseCampaign

      public SwrveBaseCampaign(ISwrveCampaignManager campaignManager, SwrveCampaignDisplayer campaignDisplayer, org.json.JSONObject campaignData) throws org.json.JSONException
      Throws:
      org.json.JSONException
  • Method Details

    • getId

      public int getId()
      Returns:
      the campaign id.
    • isMessageCenter

      public boolean isMessageCenter()
      Used internally to identify campaigns that have been marked as MessageCenter campaigns on the dashboard.
      Returns:
      true if the campaign is an MessageCenter campaign.
    • getSubject

      @Deprecated public String getSubject()
      Deprecated.
      Use SwrveMessageCenterDetails subject instead.
      This is populated by the Campaign description field from your Dashboard. Migrate to using the SwrveMessageCenterDetails subject;
      Returns:
      the name of the campaign.
    • isActive

      public boolean isActive(Date date)
      Parameters:
      date - Current date
      Returns:
      true if the campaign is active at the given time.
    • getTriggers

      public List<Trigger> getTriggers()
      Returns:
      the triggers for this campaign.
    • getImpressions

      public int getImpressions()
      Returns:
      current impressions
    • setImpressions

      public void setImpressions(int impressions)
    • getMaxImpressions

      public int getMaxImpressions()
      Returns:
      maximum impressions
    • getStartDate

      public Date getStartDate()
      Returns:
      the campaign start date.
    • getEndDate

      public Date getEndDate()
      Returns:
      the campaign end date.
    • incrementImpressions

      public void incrementImpressions()
      Increment impressions by one.
    • setMessageMinDelayThrottle

      protected void setMessageMinDelayThrottle()
      Ensures a new message cannot be shown until now + minDelayBetweenMessage
    • setStatus

      public void setStatus(SwrveCampaignState.Status status)
      Used internally to set the status of the campaign.
      Parameters:
      status - new status of the campaign
    • getStatus

      public SwrveCampaignState.Status getStatus()
      Get the status of the campaign.
      Returns:
      status of the campaign
    • getDownloadDate

      public Date getDownloadDate()
      Get the download date of the campaign.
      Returns:
      the download date of the campaign
    • messageWasHandledOrShownToUser

      public void messageWasHandledOrShownToUser()
      Used by sublcasses to inform that the campaign was displayed.
    • supportsOrientation

      public abstract boolean supportsOrientation(com.swrve.sdk.messaging.SwrveOrientation orientation)
    • getCampaignType

      public abstract com.swrve.sdk.QaCampaignInfo.CAMPAIGN_TYPE getCampaignType()
      Used by QAUser to determine what kind of campaign we are reporting
      Returns:
      CAMPAIGN_TYPE enum
    • areAssetsReady

      public abstract boolean areAssetsReady(Set<String> assetsOnDisk, Map<String,String> properties)
      Determine if the assets for this campaign have been downloaded.
      Parameters:
      assetsOnDisk - All assets that are already downloaded.
      properties - String map of personalized properties.
      Returns:
      if the assets are ready
    • getSaveableState

      public SwrveCampaignState getSaveableState()
      Obtain the serializable state of the campaign.
      Returns:
      the serializable state of the campaign.
    • setSaveableState

      public void setSaveableState(SwrveCampaignState saveableState)
      Set the previous state of this campaign.
      Parameters:
      saveableState - The state to save
    • getShowMessagesAfterLaunch

      public Date getShowMessagesAfterLaunch()
    • getName

      public String getName()
      Returns:
      the campaign name
    • getMessageCenterDetails

      public SwrveMessageCenterDetails getMessageCenterDetails()
    • setMessageCenterDetails

      public void setMessageCenterDetails(SwrveMessageCenterDetails messageCenterDetails)
    • getPriority

      public int getPriority()
      Returns:
      the priority of the campaign.