handleMessage method

void handleMessage(
  1. Map<String, dynamic> message,
  2. MessageHandlerType handlerType, {
  3. bool localNotification = false,
})

Display local notification. MessagingService calls this method to display the notification that came from message service.

Implementation

void handleMessage(
  Map<String, dynamic> message,
  MessageHandlerType handlerType, {
  bool localNotification = false,
}) {
  if (!localNotification) {
    messageSubject.add(message);
  }

  final strategy = _strategyFactory.createByData(message);

  if (handlerType == MessageHandlerType.onLaunch ||
      handlerType == MessageHandlerType.onResume) {
    strategy.onBackgroundProcess(message);
  }

  if (handlerType == MessageHandlerType.onMessage) {
    _notificationController.show(
      strategy,
      (_) {
        selectNotificationSubject.add(strategy);
        strategy.onTapNotification(PushNavigatorHolder().navigator);
      },
    );
  }
}