com.malliina.push.mpns.MPNSPayloads.scala Maven / Gradle / Ivy
package com.malliina.push.mpns
import scala.xml.{Elem, NodeSeq}
/** Do not automatically format this file.
*/
object MPNSPayloads {
def toast(message: ToastMessage): Elem =
toast(message.text1, message.text2, message.deepLink, message.silent)
/**
* @param text1 title
* @param text2 message
* @param deepLink The page to go to in app. For example: /page1.xaml?value1=1234&value2=9876
* @return
*/
def toast(text1: String, text2: String, deepLink: String, silent: Boolean): Elem = {
val silenceElement = if (silent) else NodeSeq.Empty
// payloads must be on same line of xml, do not let formatting mess it up
{text1}
{text2}
{deepLink}
{silenceElement}
}
def tile(tile: TileData): Elem = {
{tile.backgroundImage}
{tile.count}
{tile.title}
{tile.backBackgroundImage}
{tile.backTitle}
{tile.backContent}
}
def flip(flip: FlipData): Elem = {
{flip.smallBackgroundImage}
{flip.wideBackgroundImage}
{flip.wideBackBackgroundImage}
{flip.wideBackContent}
{flip.tile.backgroundImage}
{flip.tile.count}
{flip.tile.title}
{flip.tile.backBackgroundImage}
{flip.tile.backTitle}
{flip.tile.backContent}
}
def iconic(iconic: IconicData): Elem = {
{iconic.smallIconImage}
{iconic.iconImage}
{iconic.wideContent1}
{iconic.wideContent2}
{iconic.wideContent3}
{iconic.count}
{iconic.title}
{iconic.backgroundColor}
}
def cycle(tile: CycleTile): Elem = {
{tile.smallBackgroundImage}
{tile.cycleImage1}
{tile.cycleImage2}
{tile.cycleImage3}
{tile.cycleImage4}
{tile.cycleImage5}
{tile.cycleImage6}
{tile.cycleImage7}
{tile.cycleImage8}
{tile.cycleImage9}
}
}