private def breakingNewsPayload()

in notificationworkerlambda/src/main/scala/com/gu/notifications/worker/delivery/apns/models/payload/ApnsPayloadBuilder.scala [59:83]


  private def breakingNewsPayload(n: BreakingNewsNotification): ApnsPayload = {
    val link = toPlatformLink(n.link)
    val imageUrl = n.thumbnailUrl.orElse(n.imageUrl)
    val payload = PushyPayload(
      alertTitle = n.title,
      alertBody = n.message,
      categoryName = Option(n.link match {
        case _: Link.External => ""
        case _: Link.Internal => "ITEM_CATEGORY"
      }),
      mutableContent = true,
      sound = Some("default"),
      customProperties = Seq(
        CustomProperty(Keys.UniqueIdentifier -> n.id.toString),
        CustomProperty(Keys.Provider -> Provider.Guardian.value),
        CustomProperty(Keys.MessageType -> MessageTypes.NewsAlert),
        CustomProperty(Keys.NotificationType -> BreakingNews.value),
        CustomProperty(Keys.Link -> toIosLink(n.link).toString),
        CustomProperty(Keys.Topics -> n.topic.map(_.toString).mkString(",")),
        CustomProperty(Keys.Uri -> new URI(link.uri).toString),
        CustomProperty(Keys.UriType -> link.`type`.toString)
      ) ++ imageUrl.map(u => CustomProperty(Keys.ImageUrl -> u.toString)).toSeq
    ).payload
    ApnsPayload(payload, Some(BreakingNewsTtl), toCollapseId(n.link), PushType.ALERT)
  }