notificationTapped static method

Future<void> notificationTapped(
  1. Map<String, dynamic> notification
)

Called when a notification is tapped, it sends the MBMessageMetricsMetric.interaction metric. If the MBMessageMetricsMetric.view metric has not been sent yet it sends also this metric.

Implementation

static Future<void> notificationTapped(
  Map<String, dynamic> notification,
) async {
  int? messageId = _messageIdForNotification(notification);
  if (messageId == null) {
    return;
  }
  bool viewSent = await _pushNotificationMetricSent(
    MBMessageMetricsMetric.view,
    messageId,
  );
  if (!viewSent) {
    await _createMessageMetric(
      MBMessageMetricsMetric.view,
      messageId,
    );
    return _createPushNotificationMetric(
      MBMessageMetricsMetric.interaction,
      messageId,
    );
  } else {
    return _createPushNotificationMetric(
      MBMessageMetricsMetric.interaction,
      messageId,
    );
  }
}