Class SwrveMessage

  • All Implemented Interfaces:
    SwrveBaseMessage

    public class SwrveMessage
    extends java.lang.Object
    implements SwrveBaseMessage
    In-app message inside a campaign, with different formats.
    • Field Detail

      • id

        protected int id
      • name

        protected java.lang.String name
      • priority

        protected int priority
      • cacheDir

        protected java.io.File cacheDir
    • Constructor Detail

      • SwrveMessage

        public SwrveMessage​(SwrveInAppCampaign campaign,
                            java.io.File cacheDir)
      • SwrveMessage

        public SwrveMessage​(SwrveInAppCampaign campaign,
                            org.json.JSONObject messageData,
                            java.io.File cacheDir)
                     throws org.json.JSONException
        Throws:
        org.json.JSONException
    • Method Detail

      • getId

        public int getId()
        Specified by:
        getId in interface SwrveBaseMessage
        Returns:
        the message id.
      • setId

        protected void setId​(int id)
      • getName

        public java.lang.String getName()
        Returns:
        the message name.
      • setName

        protected void setName​(java.lang.String name)
      • setPriority

        public void setPriority​(int priority)
      • getFormats

        public java.util.List<SwrveMessageFormat> getFormats()
        Returns:
        list of message formats for this device.
      • getCacheDir

        public java.io.File getCacheDir()
        Returns:
        the directory where resources will be saved.
      • setCacheDir

        protected void setCacheDir​(java.io.File cacheDir)
      • getFormat

        public SwrveMessageFormat getFormat​(com.swrve.sdk.messaging.SwrveOrientation orientation)
        Search for a format with the given orientation.
        Parameters:
        orientation - Portrait, Landscape or Both.
        Returns:
        SwrveMessageFormat Message format for the specified orientation.
      • supportsOrientation

        public boolean supportsOrientation​(com.swrve.sdk.messaging.SwrveOrientation orientation)
        Returns true if the message has a format for the given orientation.
        Specified by:
        supportsOrientation in interface SwrveBaseMessage
        Parameters:
        orientation - A SwrveOrientation
        Returns:
        true if the message supports the given orientation.
      • assetInCache

        protected boolean assetInCache​(java.util.Set<java.lang.String> assetsOnDisk,
                                       java.lang.String asset)
      • areAssetsReady

        public boolean areAssetsReady​(java.util.Set<java.lang.String> assetsOnDisk,
                                      java.util.Map<java.lang.String,​java.lang.String> properties)
        Parameters:
        assetsOnDisk - Already downloaded assets on disk
        properties - properties, when applied are used to resolve the dynamic image urls that may occur
        Returns:
        true if all assets for this message have been downloaded.