How to display modal mirror push notification manually - infobip/mobile-messaging-sdk-ios GitHub Wiki
Supported on iOS since version 9.1.0
-
Disable automatic modal Mirror push notification displaying:
- Implement
MMMessageHandlingDelegate
protocol and returnfalse
from its methodshouldShowModalInAppNotification(for message: MM_MTMessage)
:
class MyMessageHandlingDelegate : MMMessageHandlingDelegate { func shouldShowModalInAppNotification(for message: MM_MTMessage) -> Bool { return false } }
- Pass the delegate object to MobileMessaging SDK:
let messageHandler = MyMessageHandlingDelegate() MobileMessaging.messageHandlindDelegate = messageHandler
- Implement
-
At the moment
MM_MTMessage
is received by your app, retrieve it either of the following ways:- by implementing
MMMessageHandlingDelegate
protocol methoddidReceiveNewMessage(message: MM_MTMessage)
class MyMessageHandlingDelegate : MMMessageHandlingDelegate { func didReceiveNewMessage(message: MM_MTMessage) { // save `message` into your variable } }
- by subscribing to
MMNotificationMessageReceived
notification (learn more about iOS NotificationCenter) and retrieving the message from the notification user data (example)
- by implementing
-
Display modal Mirror push notification for message you retrieved on the previous step:
MobileMessaging.showModalInAppNotification(forMessage: message)