[pushsafer] Add latest parameter answeroptions and answerforce (#14578)
Signed-off-by: Pushsafer.com (Kevin Siml) <info@appzer.de> Co-authored-by: Leo Siepel <leosiepel@gmail.com>pull/18477/head
parent
8b06bef914
commit
dae03087a7
|
@ -29,6 +29,8 @@ You are able to create multiple instances of this Thing to broadcast to differen
|
|||
| `confirm` | integer | Integer 10-10800 (10s steps) Time in seconds after which a message should be sent again before it is confirmed. (default: `0`). **advanced** |
|
||||
| `time2live` | integer | Time in minutes, after a message automatically gets purged (default: `0`). **advanced** |
|
||||
| `answer` | integer | 1 = enables reply to push notifications (default: `0`). **advanced** |
|
||||
| `answeroptions` | text | specify predefined answer options divided by a pipe character, e.g. Yes\|No\|Maybe **advanced** |
|
||||
| `answerforce` | integer | 1 = force an answer. The user will be prompted to answer, the message will be open directly. (default: `0`). **advanced** |
|
||||
|
||||
The `retry` and `expire` parameters are only used for emergency-priority notifications.
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ public class PushsaferBindingConstants {
|
|||
public static final String DEFAULT_VIBRATION = "1";
|
||||
public static final int DEFAULT_CONFIRM = 0;
|
||||
public static final boolean DEFAULT_ANSWER = false;
|
||||
public static final String DEFAULT_ANSWEROPTIONS = "";
|
||||
public static final boolean DEFAULT_ANSWERFORCE = false;
|
||||
public static final int DEFAULT_TIME2LIVE = 0;
|
||||
public static final String DEFAULT_TITLE = "openHAB";
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ public class PushsaferAccountConfiguration {
|
|||
public String url = DEFAULT_URL;
|
||||
public String urlTitle = DEFAULT_URLTITLE;
|
||||
public boolean answer = DEFAULT_ANSWER;
|
||||
public String answeroptions = DEFAULT_ANSWEROPTIONS;
|
||||
public boolean answerforce = DEFAULT_ANSWERFORCE;
|
||||
public int confirm = DEFAULT_CONFIRM;
|
||||
public int time2live = DEFAULT_TIME2LIVE;
|
||||
public String vibration = DEFAULT_VIBRATION;
|
||||
|
|
|
@ -57,6 +57,8 @@ public class PushsaferMessageBuilder {
|
|||
private static final String MESSAGE_KEY_SOUND = "s";
|
||||
private static final String MESSAGE_KEY_TIME2LIVE = "l";
|
||||
private static final String MESSAGE_KEY_ANSWER = "a";
|
||||
private static final String MESSAGE_KEY_ANSWEROPTIONS = "ao";
|
||||
private static final String MESSAGE_KEY_ANSWERFORCE = "af";
|
||||
private static final String MESSAGE_KEY_CONFIRM = "cr";
|
||||
private static final String MESSAGE_KEY_ATTACHMENT = "p";
|
||||
public static final String MESSAGE_KEY_HTML = "html";
|
||||
|
@ -90,6 +92,8 @@ public class PushsaferMessageBuilder {
|
|||
private int confirm;
|
||||
private int time2live;
|
||||
private boolean answer;
|
||||
private @Nullable String answeroptions;
|
||||
private boolean answerforce;
|
||||
private @Nullable String color;
|
||||
private @Nullable String vibration;
|
||||
private @Nullable String attachment;
|
||||
|
@ -181,6 +185,16 @@ public class PushsaferMessageBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public PushsaferMessageBuilder withAnswerForce(boolean answerforce) {
|
||||
this.answerforce = answerforce;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PushsaferMessageBuilder withAnswerOptions(String answeroptions) {
|
||||
this.answeroptions = answeroptions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PushsaferMessageBuilder withTime2live(int time2live) {
|
||||
this.time2live = time2live;
|
||||
return this;
|
||||
|
@ -307,6 +321,10 @@ public class PushsaferMessageBuilder {
|
|||
|
||||
body.addFieldPart(MESSAGE_KEY_ANSWER, new StringContentProvider(String.valueOf(answer)), null);
|
||||
|
||||
body.addFieldPart(MESSAGE_KEY_ANSWEROPTIONS, new StringContentProvider(String.valueOf(answeroptions)), null);
|
||||
|
||||
body.addFieldPart(MESSAGE_KEY_ANSWERFORCE, new StringContentProvider(String.valueOf(answerforce)), null);
|
||||
|
||||
body.addFieldPart(MESSAGE_KEY_TIME2LIVE, new StringContentProvider(String.valueOf(time2live)), null);
|
||||
String attachment = this.attachment;
|
||||
if (attachment != null) {
|
||||
|
|
|
@ -182,6 +182,14 @@ public class PushsaferAccountHandler extends BaseThingHandler {
|
|||
if (DEFAULT_ANSWER != config.answer) {
|
||||
builder.withAnswer(config.answer);
|
||||
}
|
||||
// add answeroptions if defined
|
||||
if (DEFAULT_ANSWEROPTIONS != config.answeroptions) {
|
||||
builder.withAnswerOptions(config.answeroptions);
|
||||
}
|
||||
// add answerforce if defined
|
||||
if (DEFAULT_ANSWERFORCE != config.answerforce) {
|
||||
builder.withAnswerForce(config.answerforce);
|
||||
}
|
||||
// add time2live if defined
|
||||
if (DEFAULT_TIME2LIVE != config.time2live) {
|
||||
builder.withTime2live(config.time2live);
|
||||
|
|
|
@ -94,6 +94,17 @@
|
|||
<description>true = Enable reply to push notifications, false otherwise.</description>
|
||||
<default>false</default>
|
||||
</parameter>
|
||||
<parameter name="answeroptions" type="text">
|
||||
<advanced>true</advanced>
|
||||
<label>Answer Options</label>
|
||||
<description>Specify predefined answer options divided by a pipe character, e.g. Yes|No|Maybe</description>
|
||||
</parameter>
|
||||
<parameter name="answerforce" type="boolean">
|
||||
<advanced>true</advanced>
|
||||
<label>Answer Force</label>
|
||||
<description>true = force an answer. The user will be prompted to answer, the message will be open directly.</description>
|
||||
<default>false</default>
|
||||
</parameter>
|
||||
</config-description>
|
||||
|
||||
</config-description:config-descriptions>
|
||||
|
|
|
@ -12,6 +12,10 @@ thing-type.pushsafer.pushsafer-account.description = Provides access to the Push
|
|||
|
||||
thing-type.config.pushsafer.pushsafer-account.answer.label = Answer
|
||||
thing-type.config.pushsafer.pushsafer-account.answer.description = true = Enable reply to push notifications, false otherwise.
|
||||
thing-type.config.pushsafer.pushsafer-account.answeroptions.label = Answer Options
|
||||
thing-type.config.pushsafer.pushsafer-account.answeroptions.description = specify predefined answer options divided by a pipe character, e.g. Yes|No|Maybe.
|
||||
thing-type.config.pushsafer.pushsafer-account.answerforce.label = Answer Force
|
||||
thing-type.config.pushsafer.pushsafer-account.answerforce.description = true = force an answer. The user will be prompted to answer, the message will be open directly.
|
||||
thing-type.config.pushsafer.pushsafer-account.apikey.label = Private or Alias Key
|
||||
thing-type.config.pushsafer.pushsafer-account.apikey.description = Your Private or Alias to access the Pushsafer Message API.
|
||||
thing-type.config.pushsafer.pushsafer-account.color.label = Icon Color
|
||||
|
|
|
@ -12,6 +12,10 @@ thing-type.pushsafer.pushsafer-account.description = Ermöglicht den Zugriff auf
|
|||
|
||||
thing-type.config.pushsafer.pushsafer-account.answer.label = Antwort
|
||||
thing-type.config.pushsafer.pushsafer-account.answer.description = true \= Aktiviere Antworten auf Push-Benachrichtigungen, sonst false.
|
||||
thing-type.config.pushsafer.pushsafer-account.answeroptions.label = Antwort Optionen
|
||||
thing-type.config.pushsafer.pushsafer-account.answeroptions.description = vordefinierte Antwortmöglichkeiten getrennt mit einem Pipe-Zeichen z.B. Ja|Nein|Vielleicht.
|
||||
thing-type.config.pushsafer.pushsafer-account.answerforce.label = Antwort erzwingen
|
||||
thing-type.config.pushsafer.pushsafer-account.answerforce.description = true \= erzwingt eine Antwort, der Nutzer wird aufgefordert zu antworten, die Nachricht wird direkt geöffnet, sonst false.
|
||||
thing-type.config.pushsafer.pushsafer-account.apikey.label = Privater Schlüssel
|
||||
thing-type.config.pushsafer.pushsafer-account.apikey.description = Ihr privater Schlüssel für den Zugriff auf die Pushsafer Nachrichten-API.
|
||||
thing-type.config.pushsafer.pushsafer-account.color.label = Icon-Farbe
|
||||
|
|
Loading…
Reference in New Issue