aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/notificators/NotificatorPushover.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/notificators/NotificatorPushover.java')
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorPushover.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/main/java/org/traccar/notificators/NotificatorPushover.java b/src/main/java/org/traccar/notificators/NotificatorPushover.java
index cf4c4026b..a9708818b 100644
--- a/src/main/java/org/traccar/notificators/NotificatorPushover.java
+++ b/src/main/java/org/traccar/notificators/NotificatorPushover.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 - 2023 Anton Tananaev (anton@traccar.org)
+ * Copyright 2020 - 2024 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,23 +16,21 @@
package org.traccar.notificators;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.inject.Inject;
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.client.Client;
+import jakarta.ws.rs.client.Entity;
import org.traccar.config.Config;
import org.traccar.config.Keys;
import org.traccar.model.Event;
-import org.traccar.model.Notification;
import org.traccar.model.Position;
import org.traccar.model.User;
import org.traccar.notification.NotificationFormatter;
-
-import jakarta.inject.Inject;
-import jakarta.inject.Singleton;
-import jakarta.ws.rs.client.Client;
-import jakarta.ws.rs.client.Entity;
+import org.traccar.notification.NotificationMessage;
@Singleton
-public class NotificatorPushover implements Notificator {
+public class NotificatorPushover extends Notificator {
- private final NotificationFormatter notificationFormatter;
private final Client client;
private final String url;
@@ -54,7 +52,7 @@ public class NotificatorPushover implements Notificator {
@Inject
public NotificatorPushover(Config config, NotificationFormatter notificationFormatter, Client client) {
- this.notificationFormatter = notificationFormatter;
+ super(notificationFormatter, "short");
this.client = client;
url = "https://api.pushover.net/1/messages.json";
token = config.getString(Keys.NOTIFICATOR_PUSHOVER_TOKEN);
@@ -62,8 +60,7 @@ public class NotificatorPushover implements Notificator {
}
@Override
- public void send(Notification notification, User user, Event event, Position position) {
- var shortMessage = notificationFormatter.formatMessage(notification, user, event, position, "short");
+ public void send(User user, NotificationMessage shortMessage, Event event, Position position) {
Message message = new Message();
message.token = token;