MoEngageSDKCards

@objc
public class MoEngageSDKCards : NSObject

Class to configure Cards

  • Singleton instance

    Declaration

    Swift

    @objc
    public static let sharedInstance: MoEngageSDKCards

Set Delegate

Sync Cards

  • Sync the cards from server

    Declaration

    Swift

    @objc
    public func syncCards(forAppID appID: String? = nil, withCompletion completionBlock: ((_ success: Bool) -> Void)? = nil)

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    Returns true if sync is successful else false

  • Method to sync the cards with app open interval

    Declaration

    Swift

    @objc
    public func onAppOpenSync(
        forAppID appID: String? = nil,
        withCompletion completionBlock: ((_ data: MoEngageCardSyncCompleteData?) -> Void)? = nil
    )

    Parameters

    appID

    account identifier

    completionBlock

    completion block to be called after sync is performed

  • Method to track inbox click and sync the cards with inbox load interval

    Declaration

    Swift

    @objc
    public func onCardSectionLoaded(
        forAppID appID: String? = nil,
        withCompletion completionBlock: ((_ data: MoEngageCardSyncCompleteData?) -> Void)? = nil
    )

    Parameters

    appID

    account identifier

    completionBlock

    completion block to be called after sync is performed

  • Method to sync the cards with pull to refresh interval

    Declaration

    Swift

    @objc
    public func refreshCards(
        forAppID appID: String? = nil,
        withCompletion completionBlock: ((_ data: MoEngageCardSyncCompleteData?) -> Void)? = nil
    )

    Parameters

    appID

    account identifier

    completionBlock

    completion block to be called after sync is performed

Fetch Cards

  • Fetch the latest cards after refreshing data with inbox sync interval.

    Declaration

    Swift

    @objc
    public func fetchCards(
        forAppID appID: String? = nil,
        withCompletion completionBlock: ((_ data: MoEngageCardData?) -> Void)? = nil
    )

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with cards data and account info

Card Status

  • Fetch Cards status

    Declaration

    Swift

    public func getAllCardStatusDict(forAppID appID: String? = nil, withCompletionBlock completionBlock: @escaping (([[String : Any]]) -> Void))

    Parameters

    appID

    MoEngage Account Identifier

    Return Value

    Array of dictionary containing card status

Cards Data

  • Method to fetch Cards data

    Declaration

    Swift

    @objc
    public func getCardsData(forAppID appID: String? = nil, withCompletionBlock completionBlock: @escaping ((_ cardsData: MoEngageCardsData?, _ accountMeta: MoEngageAccountMeta?) -> Void))

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with cards data and account info.

  • Fetch Cards categories

    Declaration

    Swift

    @objc
    public func getCardsCategories(forAppID appID: String? = nil, withCompletionBlock completionBlock: @escaping ((_ categories: Array<String>, _ accountMeta: MoEngageAccountMeta?) -> Void))

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with cards categories and account info.

  • Fetch Cards campaign for given category

    Declaration

    Swift

    @objc
    public func getCards(forCategory category: String, forAppID appID: String? = nil, withCompletionBlock completionBlock: @escaping ((_ cards: Array<MoEngageCardCampaign>, _ accountMeta: MoEngageAccountMeta?) -> Void))

    Parameters

    category

    category for which cards should be fetched.

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with cards campaign info and account info.

  • Fetch ShowAllTab status.

    Declaration

    Swift

    @objc
    public func isAllCategoryEnabled(forAppID appID: String? = nil, withCompletionBlock completionBlock: @escaping ((Bool) -> Void))

    Parameters

    appID

    MoEngage Account Identifier

    Return Value

    true if All tab is shown else false

  • Track cards shown event and update delivery counters accordingly.

    Declaration

    Swift

    @objc
    public func cardShown(_ card: MoEngageCardCampaign, forAppID appID: String? = nil)

    Parameters

    card

    instance of MoEngageCardCampaign

    appID

    MoEngage Account Identifier

  • Mark the card as clicked and tracks an event for statistical purpose.

    Declaration

    Swift

    @objc
    public func cardClicked(_ card: MoEngageCardCampaign, forAppID appID: String? = nil)

    Parameters

    card

    instance of MoEngageCardCampaign

    appID

    MoEngage Account Identifier

  • Mark a card as clicked and tracks an event for statistical purpose.

    Declaration

    Swift

    @objc
    public func cardClicked(_ card: MoEngageCardCampaign, withWidgetID widgetID: Int, forAppID appID: String? = nil)

    Parameters

    card

    instance of MoEngageCardCampaign

    widgetID

    unique identifier for the widget that was clicked

    appID

    MoEngage Account Identifier

  • Mark card delivered event

    Declaration

    Swift

    @objc
    public func cardDelivered(_ card: MoEngageCardCampaign, forAppID appID: String? = nil)

    Parameters

    card

    instance of MoEngageCardCampaign

    appID

    MoEngage Account Identifier

  • Method to mark tracking delivery of all cards to inbox.

    Declaration

    Swift

    @objc
    public func cardDelivered(forAppID appID: String? = nil)

    Parameters

    appID

    account identifier.

  • Delete the cards

    Declaration

    Swift

    @objc
    public func deleteCards(_ cardsArr: [MoEngageCardCampaign], forAppID appID: String? = nil, andCompletionBlock completionBlock: @escaping ((_ isDeleted: Bool, _ accountMeta: MoEngageAccountMeta?) -> Void))

    Parameters

    cardsArr
    appID

    MoEngage Account Identifier

    completionBlock

    completion block called once card is deleted.

Inbox Lifecycle

  • Track impression for loading CardsController

    Declaration

    Swift

    @objc
    public func cardsViewControllerLoaded(forAppID appID: String? = nil)

    Parameters

    appID

    MoEngage Account identifier

  • Dismiss CardsViewController

    Declaration

    Swift

    @objc
    public func cardsViewControllerDismissed(forAppID appID: String? = nil)

    Parameters

    appID

    MoEngage Account Identifier

Cards Count

  • Fetch new cards count

    Declaration

    Swift

    @objc
    public func getNewCardsCount(forAppID appID: String? = nil, withCompletionBlock completionBlock: @escaping ((_ count: Int, _ accountMeta: MoEngageAccountMeta?) -> Void))

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with new cards count and account info.

  • Fetch unclicked cards count

    Declaration

    Swift

    @objc
    public func getUnclickedCardsCount(forAppID appID: String? = nil, withCompletionBlock completionBlock: @escaping ((_ count: Int, _ accountMeta: MoEngageAccountMeta?) -> Void))

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with unclicked cards count and account info.

  • Fetch clicked cards count

    Declaration

    Swift

    @objc
    public func getClickedCardsCount(forAppID appID: String? = nil, withCompletionBlock completionBlock: @escaping ((_ count: Int, _ accountMeta: MoEngageAccountMeta?) -> Void))

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with clicked cards count and account info.

UI Methods