BatchMessaging

@interface BatchMessaging

Batch’s messaging module

  • Sets Batch’s messaging delegate. The delegate is used for optionaly informing your code about analytics event, or handling In-App messages manually.

    Declaration

    Objective-C

    + (void)setDelegate:(id<BatchMessagingDelegate> _Nullable)delegate;

    Parameters

    delegate

    Your messaging delegate, weakly retained. Set it to nil to remove it.

  • Toggles whether Batch should change the shared AVAudioSession configuration by itelf. It is used to avoid stopping the user’s music when displaying a video inapp, but this may have undesirable effects on your app.

    Declaration

    Objective-C

    + (void)setCanReconfigureAVAudioSession:(id)canReconfigureAVAudioSession;

    Parameters

    canReconfigureAVAudioSession

    Whether or not Batch can change the AVAudioSession.

  • Toggles whether Batch should display the messaging views automatically when coming from a notification. Note that if automatic mode is enabled, manual integration methods will not work. In-App messaging is not affected by this. If you want to manually display the In-App message, call setDelegate: with a delegate that implement batchInAppMessageReady:

    Declaration

    Objective-C

    + (void)setAutomaticMode:(id)isAutomaticModeOn;

    Parameters

    isAutomaticModeOn

    Whether to enable automatic mode or not

  • Toogles whether BatchMessaging should enter its “do not disturb” (DnD) mode or exit it.

    While in DnD, Batch will not display landings, not matter if they’ve been triggered by notifications or an In-App Campaign, even in automatic mode.

    This mode is useful for times where you don’t want Batch to interrupt your user, such as during a splashscreen, a video or an interstitial ad.

    If a message should have been displayed during DnD, Batch will enqueue it, overwriting any previously enqueued message. When exiting DnD, Batch will not display the message automatically: you’ll have to call the queue management methods to display the message, if you want to.

    See BatchMessaging.hasPendingMessage, popPendingMessage() or showPendingMessage() to manage enqueued messages.

    Note: This is only supported if automatic mode is enabled. Messages will not be enqueued, as they will be delivered to your delegate.

    Declaration

    Objective-C

    @property (class, nonatomic) int doNotDisturb;
  • Returns whether Batch has an enqueued message from “do not disturb” mode.

    Declaration

    Objective-C

    @property (class, readonly) int hasPendingMessage;
  • Gets the pending message (if any), enqueued while Batch was (or still is) in “do not disturb” mode. Note: Calling this will remove the pending message from Batch’s queue: subsequent calls will return nil until a new message has been enqueued.

    Declaration

    Objective-C

    + (BatchMessage *_Nullable)popPendingMessage;

    Return Value

    A BatchMessage instance if there was a pending message.

  • Shows the currently enqueued message, if any. Removes the pending message from the queue (like if popPendingMessage was called).

    Declaration

    Objective-C

    + (id)showPendingMessage;

    Return Value

    true if there was an enqueued message to show, false otherwise. Is a message was enqueued but failed to display, the return value will be true.

  • Override the font used in message views. Not applicable for standard alerts.

    If a variant is missing but there is a base font present, the SDK will fallback on the base fond you provided rather than the system one. This can lead to missing styles. Setting a nil base font override will disable all other overrides.

    Declaration

    Objective-C

    + (void)setFontOverride:(id)font boldFont:(id)boldFont;

    Parameters

    font

    UIFont to use for normal text. Use ‘nil’ to revert to the system font.

    boldFont

    UIFont to use for bold text. Use ‘nil’ to revert to the system font.

  • Override the font used in message views. Not applicable for standard alerts.

    If a variant is missing but there is a base font present, the SDK will fallback on the base fond you provided rather than the system one. This can lead to missing styles. Setting a nil base font override will disable all other overrides.

    Declaration

    Objective-C

    + (void)setFontOverride:(id)font
                   boldFont:(id)boldFont
                 italicFont:(id)italicFont
             boldItalicFont:(id)boldItalicFont;

    Parameters

    font

    UIFont to use for normal text. Use ‘nil’ to revert to the system font.

    boldFont

    UIFont to use for bold text. Use ‘nil’ to revert to the system font.

    italicFont

    UIFont to use for italic text. Use ‘nil’ to revert to the system font.

    boldItalicFont

    UIFont to use for bolditalic text. Use ‘nil’ to revert to the system font.

  • Undocumented

    Declaration

    Objective-C

    + (nullable BatchPushMessage *)messageFromPushPayload:(id)userData;
  • Try to load a messaging view controller for a given payload.

    Do not make assumptions about the returned UIViewController subclass as it can change in a future release.

    You can then display this view controller modally, or in a dedicated window. The view controller conforms to the BatchMessagingViewController protocol, you can call “shouldDisplayInSeparateWindow” to know how this VC would like to be presented.

    You can also use “presentMessagingViewController” to tell Batch to try to display it itself.

    Warning

    This method should only be called on the UI thread

    Declaration

    Objective-C

    + (id)loadViewControllerForMessage:(BatchMessage *_Nonnull)message
                                 error:(id)error;

    Parameters

    message

    The notification’s payload. Typically the verbatim userData dictionary given to you in the app delegate.

    error

    If there is an error creating the view controller, upon return contains an NSError object that describes the problem.

    Return Value

    The view controller you should present. nil if an error occurred.

  • Try to automatically present the given Batch Messaging View Controller, in the most appropriate way.

    This method will do nothing if you don’t give it a UIViewController loaded by [BatchMessaging loadViewControllerForMessage:error:]

    Declaration

    Objective-C

    + (void)presentMessagingViewController:(id)vc;