Package com.swrve.sdk.messaging
Class SwrveBaseCampaign
java.lang.Object
com.swrve.sdk.messaging.SwrveBaseCampaign
- Direct Known Subclasses:
SwrveConversationCampaign
,SwrveEmbeddedCampaign
,SwrveInAppCampaign
-
Field Summary
Modifier and TypeFieldDescriptionprotected SwrveCampaignDisplayer
protected ISwrveCampaignManager
protected static int
protected static int
protected static int
protected Date
protected int
protected int
protected boolean
protected SwrveMessageCenterDetails
protected int
protected String
protected int
protected SwrveCampaignState
protected Date
protected Date
protected String
-
Constructor Summary
ConstructorDescriptionSwrveBaseCampaign
(ISwrveCampaignManager campaignManager, SwrveCampaignDisplayer campaignDisplayer, org.json.JSONObject campaignData) -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Determine if the assets for this campaign have been downloaded.abstract com.swrve.sdk.QaCampaignInfo.CAMPAIGN_TYPE
Used by QAUser to determine what kind of campaign we are reportingGet the download date of the campaign.int
getId()
int
int
getName()
int
Obtain the serializable state of the campaign.Get the status of the campaign.Deprecated.Use SwrveMessageCenterDetails subject instead.void
Increment impressions by one.boolean
boolean
Used internally to identify campaigns that have been marked as MessageCenter campaigns on the dashboard.void
Used by sublcasses to inform that the campaign was displayed.void
setImpressions
(int impressions) void
setMessageCenterDetails
(SwrveMessageCenterDetails messageCenterDetails) protected void
Ensures a new message cannot be shown until now + minDelayBetweenMessagevoid
setSaveableState
(SwrveCampaignState saveableState) Set the previous state of this campaign.void
setStatus
(SwrveCampaignState.Status status) Used internally to set the status of the campaign.abstract boolean
supportsOrientation
(com.swrve.sdk.messaging.SwrveOrientation orientation)
-
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
-
campaignDisplayer
-
id
protected int id -
saveableState
-
startDate
-
endDate
-
triggers
-
messageCenter
protected boolean messageCenter -
subject
-
priority
protected int priority -
maxImpressions
protected int maxImpressions -
minDelayBetweenMessage
protected int minDelayBetweenMessage -
showMessagesAfterLaunch
-
name
-
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.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
- Parameters:
date
- Current date- Returns:
- true if the campaign is active at the given time.
-
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
- Returns:
- the campaign start 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
Used internally to set the status of the campaign.- Parameters:
status
- new status of the campaign
-
getStatus
Get the status of the campaign.- Returns:
- status of the campaign
-
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
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
Obtain the serializable state of the campaign.- Returns:
- the serializable state of the campaign.
-
setSaveableState
Set the previous state of this campaign.- Parameters:
saveableState
- The state to save
-
getShowMessagesAfterLaunch
-
getName
- Returns:
- the campaign name
-
getMessageCenterDetails
-
setMessageCenterDetails
-
getPriority
public int getPriority()- Returns:
- the priority of the campaign.
-