diff options
author | soshial <soshial@gmail.com> | 2021-04-25 10:28:11 +0400 |
---|---|---|
committer | soshial <soshial@gmail.com> | 2021-04-25 10:28:11 +0400 |
commit | 516dce5aedf9b45557e6d1eb62ac797987290c1f (patch) | |
tree | 0b0458cd4533f6ec7df56871f50703a2a1136a7d /src/main | |
parent | 383d61a7ebb64ea142fce47b3c6c627e5cb90be4 (diff) | |
download | trackermap-server-516dce5aedf9b45557e6d1eb62ac797987290c1f.tar.gz trackermap-server-516dce5aedf9b45557e6d1eb62ac797987290c1f.tar.bz2 trackermap-server-516dce5aedf9b45557e6d1eb62ac797987290c1f.zip |
cleanse NotificatorTelegram before merge
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/notificators/NotificatorTelegram.java | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/main/java/org/traccar/notificators/NotificatorTelegram.java b/src/main/java/org/traccar/notificators/NotificatorTelegram.java index 607eeaf24..bd23684d4 100644 --- a/src/main/java/org/traccar/notificators/NotificatorTelegram.java +++ b/src/main/java/org/traccar/notificators/NotificatorTelegram.java @@ -16,7 +16,6 @@ package org.traccar.notificators; import com.fasterxml.jackson.annotation.JsonProperty; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.traccar.Context; @@ -25,7 +24,6 @@ import org.traccar.model.Event; import org.traccar.model.Position; import org.traccar.notification.NotificationFormatter; -import javax.annotation.Nullable; import javax.ws.rs.client.Entity; import javax.ws.rs.client.InvocationCallback; @@ -42,9 +40,6 @@ public class NotificatorTelegram extends Notificator { private String chatId; @JsonProperty("text") private String text; - @Nullable - @JsonProperty("reply_to_message_id") - private Long replyToMessageId; @JsonProperty("parse_mode") private String parseMode = "html"; } @@ -86,20 +81,24 @@ public class NotificatorTelegram extends Notificator { }); } + private LocationMessage createMessage(Position position) { + LocationMessage locationMessage = new LocationMessage(); + locationMessage.chatId = chatId; + locationMessage.latitude = position.getLatitude(); + locationMessage.longitude = position.getLongitude(); + locationMessage.bearing = (int) Math.ceil(position.getCourse()); + locationMessage.accuracy = position.getAccuracy(); + return locationMessage; + } + @Override public void sendSync(long userId, Event event, Position position) { if (position != null) { - LocationMessage locationMessage = new LocationMessage(); - locationMessage.chatId = chatId; - locationMessage.latitude = position.getLatitude(); - locationMessage.longitude = position.getLongitude(); - locationMessage.bearing = (int) Math.ceil(position.getCourse()); - locationMessage.accuracy = position.getAccuracy(); + LocationMessage locationMessage = createMessage(position); executeRequest(urlSendLocation, locationMessage); } TextMessage message = new TextMessage(); message.chatId = chatId; - // message.replyToMessageId = Long.MIN_VALUE; TODO add message ID from the first request here message.text = NotificationFormatter.formatFullMessage(userId, event, position).getBody(); executeRequest(urlSendText, message); } |