aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/notificators
diff options
context:
space:
mode:
authorKhaksar Weqar <wkhaksar1@gmail.com>2021-11-04 09:56:42 +0100
committerKhaksar Weqar <wkhaksar1@gmail.com>2021-11-04 09:56:42 +0100
commit2c4b4cdd2e8c8c09bcbdc18dd9cbaeba5bd64ce7 (patch)
tree958d3151cc5cd3d0c4bf2b72016c90c92dc3659b /src/main/java/org/traccar/notificators
parent64d38de4a3c8063ca8aabdc5583843e6db3c9446 (diff)
downloadtrackermap-server-2c4b4cdd2e8c8c09bcbdc18dd9cbaeba5bd64ce7.tar.gz
trackermap-server-2c4b4cdd2e8c8c09bcbdc18dd9cbaeba5bd64ce7.tar.bz2
trackermap-server-2c4b4cdd2e8c8c09bcbdc18dd9cbaeba5bd64ce7.zip
formatting-reverted
Diffstat (limited to 'src/main/java/org/traccar/notificators')
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorFirebase.java7
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorMail.java6
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorPushover.java6
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorSms.java6
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorTelegram.java4
5 files changed, 14 insertions, 15 deletions
diff --git a/src/main/java/org/traccar/notificators/NotificatorFirebase.java b/src/main/java/org/traccar/notificators/NotificatorFirebase.java
index 9d1982f9c..37d0cb25a 100644
--- a/src/main/java/org/traccar/notificators/NotificatorFirebase.java
+++ b/src/main/java/org/traccar/notificators/NotificatorFirebase.java
@@ -24,9 +24,8 @@ import org.traccar.config.Keys;
import org.traccar.model.Event;
import org.traccar.model.Position;
import org.traccar.model.User;
-import org.traccar.notification.FullMessage;
+import org.traccar.notification.NotificationMessage;
import org.traccar.notification.NotificationFormatter;
-import org.traccar.notification.ShortMessage;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
@@ -70,10 +69,10 @@ public class NotificatorFirebase extends Notificator {
final User user = Context.getPermissionsManager().getUser(userId);
if (user.getAttributes().containsKey("notificationTokens")) {
- ShortMessage shortMessage = NotificationFormatter.formatShortMessage(userId, event, position);
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position,"short");
Notification notification = new Notification();
- notification.title= shortMessage.getTitle();
+ notification.title= shortMessage.getSubject();
notification.body = shortMessage.getBody();
notification.sound = "default";
diff --git a/src/main/java/org/traccar/notificators/NotificatorMail.java b/src/main/java/org/traccar/notificators/NotificatorMail.java
index 6b9774c58..48e9d2311 100644
--- a/src/main/java/org/traccar/notificators/NotificatorMail.java
+++ b/src/main/java/org/traccar/notificators/NotificatorMail.java
@@ -19,7 +19,7 @@ package org.traccar.notificators;
import org.traccar.Context;
import org.traccar.model.Event;
import org.traccar.model.Position;
-import org.traccar.notification.FullMessage;
+import org.traccar.notification.NotificationMessage;
import org.traccar.notification.MessageException;
import org.traccar.notification.NotificationFormatter;
@@ -30,8 +30,8 @@ public final class NotificatorMail extends Notificator {
@Override
public void sendSync(long userId, Event event, Position position) throws MessageException {
try {
- FullMessage message = NotificationFormatter.formatFullMessage(userId, event, position);
- Context.getMailManager().sendMessage(userId, message.getSubject(), message.getBody());
+ NotificationMessage fullMessage = NotificationFormatter.formatMessage(userId, event, position,"full");
+ Context.getMailManager().sendMessage(userId, fullMessage.getSubject(), fullMessage.getBody());
} catch (MessagingException e) {
throw new MessageException(e);
}
diff --git a/src/main/java/org/traccar/notificators/NotificatorPushover.java b/src/main/java/org/traccar/notificators/NotificatorPushover.java
index e541ea525..b62be7654 100644
--- a/src/main/java/org/traccar/notificators/NotificatorPushover.java
+++ b/src/main/java/org/traccar/notificators/NotificatorPushover.java
@@ -24,7 +24,7 @@ import org.traccar.model.Event;
import org.traccar.model.Position;
import org.traccar.model.User;
import org.traccar.notification.NotificationFormatter;
-import org.traccar.notification.ShortMessage;
+import org.traccar.notification.NotificationMessage;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
@@ -77,13 +77,13 @@ public class NotificatorPushover extends Notificator {
return;
}
- ShortMessage shortMessage = NotificationFormatter.formatShortMessage(userId, event, position);
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position,"short");
Message message = new Message();
message.token = token;
message.user = this.user;
message.device = device;
- message.title= shortMessage.getTitle();
+ message.title= shortMessage.getSubject();
message.message = shortMessage.getBody();
Context.getClient().target(url).request()
diff --git a/src/main/java/org/traccar/notificators/NotificatorSms.java b/src/main/java/org/traccar/notificators/NotificatorSms.java
index 360eb44ff..c99b555ce 100644
--- a/src/main/java/org/traccar/notificators/NotificatorSms.java
+++ b/src/main/java/org/traccar/notificators/NotificatorSms.java
@@ -24,7 +24,7 @@ import org.traccar.model.Position;
import org.traccar.model.User;
import org.traccar.notification.MessageException;
import org.traccar.notification.NotificationFormatter;
-import org.traccar.notification.ShortMessage;
+import org.traccar.notification.NotificationMessage;
public final class NotificatorSms extends Notificator {
@@ -32,7 +32,7 @@ public final class NotificatorSms extends Notificator {
public void sendAsync(long userId, Event event, Position position) {
final User user = Context.getPermissionsManager().getUser(userId);
if (user.getPhone() != null) {
- ShortMessage shortMessage = NotificationFormatter.formatShortMessage(userId, event, position);
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position,"short");
Main.getInjector().getInstance(StatisticsManager.class).registerSms();
Context.getSmsManager().sendMessageAsync(user.getPhone(),
shortMessage.getBody(), false);
@@ -43,7 +43,7 @@ public final class NotificatorSms extends Notificator {
public void sendSync(long userId, Event event, Position position) throws MessageException, InterruptedException {
final User user = Context.getPermissionsManager().getUser(userId);
if (user.getPhone() != null) {
- ShortMessage shortMessage = NotificationFormatter.formatShortMessage(userId, event, position);
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position,"short");
Main.getInjector().getInstance(StatisticsManager.class).registerSms();
Context.getSmsManager().sendMessageSync(user.getPhone(),
shortMessage.getBody(), false);
diff --git a/src/main/java/org/traccar/notificators/NotificatorTelegram.java b/src/main/java/org/traccar/notificators/NotificatorTelegram.java
index a8cdacfbf..62a5a14ff 100644
--- a/src/main/java/org/traccar/notificators/NotificatorTelegram.java
+++ b/src/main/java/org/traccar/notificators/NotificatorTelegram.java
@@ -25,7 +25,7 @@ import org.traccar.config.Keys;
import org.traccar.model.Event;
import org.traccar.model.Position;
import org.traccar.notification.NotificationFormatter;
-import org.traccar.notification.ShortMessage;
+import org.traccar.notification.NotificationMessage;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
@@ -99,7 +99,7 @@ public class NotificatorTelegram extends Notificator {
@Override
public void sendSync(long userId, Event event, Position position) {
User user = Context.getPermissionsManager().getUser(userId);
- ShortMessage shortMessage = NotificationFormatter.formatShortMessage(userId, event, position);
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position,"short");
TextMessage message = new TextMessage();
message.chatId = user.getString("telegramChatId");