Added option for sending message as monospace message
This commit is contained in:
parent
f5ad9e859c
commit
21013a6297
@ -36,6 +36,7 @@ public class Message {
|
|||||||
private String proxyHost;
|
private String proxyHost;
|
||||||
private int proxyPort;
|
private int proxyPort;
|
||||||
private boolean html;
|
private boolean html;
|
||||||
|
private boolean monospace;
|
||||||
|
|
||||||
public Message() {
|
public Message() {
|
||||||
this.withSound(Sound.PUSHOVER);
|
this.withSound(Sound.PUSHOVER);
|
||||||
@ -141,15 +142,28 @@ public class Message {
|
|||||||
this.url = url;
|
this.url = url;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables HTML in the pushover message
|
* Enables HTML in the pushover message
|
||||||
|
* Either HTML or monospace can be enabled
|
||||||
|
* (optional)
|
||||||
|
*
|
||||||
|
* @return Message instance
|
||||||
|
*/
|
||||||
|
public final Message enableMonospace() {
|
||||||
|
this.monospace = (this.html) ? false : true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables HTML in the pushover message
|
||||||
|
* Either HTML or monospace can be enabled
|
||||||
* (optional)
|
* (optional)
|
||||||
*
|
*
|
||||||
* @return Message instance
|
* @return Message instance
|
||||||
*/
|
*/
|
||||||
public final Message enableHtml() {
|
public final Message enableHtml() {
|
||||||
this.html = true;
|
this.html = (this.monospace) ? false : true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,6 +309,7 @@ public class Message {
|
|||||||
body.put(Param.TIMESTAMP.toString(), this.timestamp);
|
body.put(Param.TIMESTAMP.toString(), this.timestamp);
|
||||||
body.put(Param.SOUND.toString(), this.sound.toString());
|
body.put(Param.SOUND.toString(), this.sound.toString());
|
||||||
body.put(Param.HTML.toString(), this.html ? "1" : "0");
|
body.put(Param.HTML.toString(), this.html ? "1" : "0");
|
||||||
|
body.put(Param.MONOSPACE.toString(), this.monospace ? "1" : "0");
|
||||||
|
|
||||||
return new PushoverRequest().push(MESSAGE_URL, body, this.proxyHost, this.proxyPort);
|
return new PushoverRequest().push(MESSAGE_URL, body, this.proxyHost, this.proxyPort);
|
||||||
}
|
}
|
||||||
|
@ -8,23 +8,24 @@ package de.svenkubiak.jpushover.enums;
|
|||||||
public enum Param {
|
public enum Param {
|
||||||
ATTACHMENT("attachment"),
|
ATTACHMENT("attachment"),
|
||||||
CALLBACK("callback"),
|
CALLBACK("callback"),
|
||||||
|
COUNT("count"),
|
||||||
DEVICE("device"),
|
DEVICE("device"),
|
||||||
EXPIRE("expire"),
|
EXPIRE("expire"),
|
||||||
HTML("html"),
|
HTML("html"),
|
||||||
MESSAGE("message"),
|
MESSAGE("message"),
|
||||||
|
MONOSPACE("monospace"),
|
||||||
|
PERCENT("percent"),
|
||||||
PRIORITY("priority"),
|
PRIORITY("priority"),
|
||||||
RETRY("retry"),
|
RETRY("retry"),
|
||||||
SOUND("sound"),
|
SOUND("sound"),
|
||||||
|
SUBTEXT("subtext"),
|
||||||
|
TEXT("text"),
|
||||||
TIMESTAMP("timestamp"),
|
TIMESTAMP("timestamp"),
|
||||||
TITLE("title"),
|
TITLE("title"),
|
||||||
TOKEN("token"),
|
TOKEN("token"),
|
||||||
URL("url"),
|
URL("url"),
|
||||||
URLTITLE("urltitle"),
|
URLTITLE("urltitle"),
|
||||||
USER("user"),
|
USER("user");
|
||||||
TEXT("text"),
|
|
||||||
SUBTEXT("subtext"),
|
|
||||||
COUNT("count"),
|
|
||||||
PERCENT("percent");
|
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user