private def footballMatchStatusAndroidNotification()

in notificationworkerlambda/src/main/scala/com/gu/notifications/worker/delivery/fcm/models/payload/FcmPayloadBuilder.scala [106:181]


  private def footballMatchStatusAndroidNotification(matchStatusAlert: FootballMatchStatusNotification): FirebaseAndroidNotification =
    FirebaseAndroidNotification(
      notificationId = matchStatusAlert.id,
      data = Map(
        Keys.Type -> MessageTypes.FootballMatchAlert,
        Keys.HomeTeamName -> matchStatusAlert.homeTeamName,
        Keys.HomeTeamId -> matchStatusAlert.homeTeamId,
        Keys.HomeTeamScore -> matchStatusAlert.homeTeamScore.toString,
        Keys.HomeTeamText -> matchStatusAlert.homeTeamMessage,
        Keys.AwayTeamName -> matchStatusAlert.awayTeamName,
        Keys.AwayTeamId -> matchStatusAlert.awayTeamId,
        Keys.AwayTeamScore -> matchStatusAlert.awayTeamScore.toString,
        Keys.AwayTeamText -> matchStatusAlert.awayTeamMessage,
        Keys.CurrentMinute -> "",
        Keys.Importance -> matchStatusAlert.importance.toString,
        Keys.MatchStatus -> matchStatusAlert.matchStatus,
        Keys.MatchId -> matchStatusAlert.matchId,
        Keys.MatchInfoUri -> matchStatusAlert.matchInfoUri.toString
      ) ++ matchStatusAlert.articleUri.map(Keys.ArticleUri -> _.toString).toMap
        ++ matchStatusAlert.competitionName.map(Keys.CompetitionName -> _).toMap
        ++ matchStatusAlert.venue.map(Keys.Venue -> _).toMap,
      ttl = FootballMatchStatusTtl
    )

  private def editionsAndroidNotification(editionsShardNotification: EditionsNotification): FirebaseAndroidNotification =
    FirebaseAndroidNotification(
      notificationId = editionsShardNotification.id,
      data = Map (
        Keys.Type -> MessageTypes.Custom,
        Keys.NotificationType -> editionsShardNotification.`type`.value,
        Keys.Topics -> editionsShardNotification.topic.map(toAndroidTopic).mkString(","),
        Keys.Importance -> editionsShardNotification.importance.toString,
        Keys.EditionsDate -> editionsShardNotification.date,
        Keys.EditionsKey -> editionsShardNotification.key,
        Keys.EditionsName -> editionsShardNotification.name
      ) ++ editionsShardNotification.message.map(Keys.Message -> _.toString).toMap
    )

  private def us2020ResultsNotification(notification: Us2020ResultsNotification): FirebaseAndroidNotification = {
    val title = notification.title.getOrElse("US elections 2020: Live results")
    val message = notification.message.getOrElse("")
    val link = toPlatformLink(notification.link)

    FirebaseAndroidNotification(
      notificationId = notification.id,
      data = Map(
        Keys.Type -> MessageTypes.Us2020Results,
        Keys.Importance -> notification.importance.toString,
        Keys.Topics -> notification.topic.map(toAndroidTopic).mkString(","),
        Keys.Title -> title,
        Keys.Link -> toAndroidLink(notification.link).toString,
        Keys.Uri -> new URI(link.uri).toString,
        Keys.ExpandedTitle -> notification.expandedTitle,
        Keys.LeftCandidateName -> notification.leftCandidateName,
        Keys.LeftCandidateColour -> notification.leftCandidateColour,
        Keys.LeftCandidateColourDark -> notification.leftCandidateColourDark,
        Keys.LeftCandidateDelegates -> notification.leftCandidateDelegates.toString,
        Keys.LeftCandidateVoteShare -> notification.leftCandidateVoteShare,
        Keys.RightCandidateName -> notification.rightCandidateName,
        Keys.RightCandidateColour -> notification.rightCandidateColour,
        Keys.RightCandidateColourDark -> notification.rightCandidateColourDark,
        Keys.RightCandidateDelegates -> notification.rightCandidateDelegates.toString,
        Keys.RightCandidateVoteShare -> notification.rightCandidateVoteShare,
        Keys.TotalDelegates -> notification.totalDelegates.toString,
        Keys.DelegatesToWin -> notification.delegatesToWin,
        Keys.Message -> message,
        Keys.ExpandedMessage-> notification.expandedMessage,
        Keys.Button1Text -> notification.button1Text,
        Keys.Button1Url -> notification.button1Url,
        Keys.Button2Text -> notification.button2Text,
        Keys.Button2Url -> notification.button2Url,
        Keys.StopButtonText -> notification.stopButtonText
      ),
      ttl = BreakingNewsTtl
    )
  }