aboutsummaryrefslogtreecommitdiffstats
path: root/src/standardPush/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-10-20 13:41:25 +0200
committerChristian Schneppe <christian@pix-art.de>2018-10-20 13:41:25 +0200
commit3cdc753ecac1662caef89e23bf7ecd883d2db196 (patch)
tree1433fdbef14d9495cfccf5ee2fbbe1a3bcaa1cad /src/standardPush/java
parentd519f1df874a16394b26456f132b3083ad68b116 (diff)
enable push messages
Diffstat (limited to 'src/standardPush/java')
-rw-r--r--src/standardPush/java/de/pixart/messenger/services/InstanceIdService.java1
-rw-r--r--src/standardPush/java/de/pixart/messenger/services/MaintenanceReceiver.java1
-rw-r--r--src/standardPush/java/de/pixart/messenger/services/PushManagementService.java10
-rw-r--r--src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java3
4 files changed, 12 insertions, 3 deletions
diff --git a/src/standardPush/java/de/pixart/messenger/services/InstanceIdService.java b/src/standardPush/java/de/pixart/messenger/services/InstanceIdService.java
index 3db7219c0..3e9a00a3c 100644
--- a/src/standardPush/java/de/pixart/messenger/services/InstanceIdService.java
+++ b/src/standardPush/java/de/pixart/messenger/services/InstanceIdService.java
@@ -1,6 +1,7 @@
package de.pixart.messenger.services;
import android.content.Intent;
+
import com.google.firebase.iid.FirebaseInstanceIdService;
public class InstanceIdService extends FirebaseInstanceIdService {
diff --git a/src/standardPush/java/de/pixart/messenger/services/MaintenanceReceiver.java b/src/standardPush/java/de/pixart/messenger/services/MaintenanceReceiver.java
index 9ee13c6cd..9368913bc 100644
--- a/src/standardPush/java/de/pixart/messenger/services/MaintenanceReceiver.java
+++ b/src/standardPush/java/de/pixart/messenger/services/MaintenanceReceiver.java
@@ -32,5 +32,6 @@ public class MaintenanceReceiver extends BroadcastReceiver {
Log.d(Config.LOGTAG, "unable to renew instance token", e);
}
}).start();
+
}
} \ No newline at end of file
diff --git a/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java b/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java
index b9aff036b..7daa552d4 100644
--- a/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java
+++ b/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java
@@ -2,7 +2,12 @@ package de.pixart.messenger.services;
import android.util.Log;
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.GoogleApiAvailability;
+import com.google.firebase.iid.FirebaseInstanceId;
+
import de.pixart.messenger.Config;
+import de.pixart.messenger.R;
import de.pixart.messenger.entities.Account;
import de.pixart.messenger.utils.Namespace;
import de.pixart.messenger.utils.PhoneHelper;
@@ -14,8 +19,6 @@ import rocks.xmpp.addr.Jid;
public class PushManagementService {
- private static final Jid APP_SERVER = Jid.of("p2.siacs.eu");
-
protected final XmppConnectionService mXmppConnectionService;
PushManagementService(XmppConnectionService service) {
@@ -26,7 +29,8 @@ public class PushManagementService {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": has push support");
retrieveFcmInstanceToken(token -> {
final String androidId = PhoneHelper.getAndroidId(mXmppConnectionService);
- IqPacket packet = mXmppConnectionService.getIqGenerator().pushTokenToAppServer(APP_SERVER, token, androidId);
+ final Jid appServer = Jid.of(mXmppConnectionService.getString(R.string.app_server));
+ IqPacket packet = mXmppConnectionService.getIqGenerator().pushTokenToAppServer(appServer, token, androidId);
mXmppConnectionService.sendIqPacket(account, packet, (a, p) -> {
Element command = p.findChild("command", "http://jabber.org/protocol/commands");
if (p.getType() == IqPacket.TYPE.RESULT && command != null) {
diff --git a/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java b/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java
index d45ded454..816d11118 100644
--- a/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java
+++ b/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java
@@ -3,6 +3,9 @@ package de.pixart.messenger.services;
import android.content.Intent;
import android.util.Log;
+import com.google.firebase.messaging.FirebaseMessagingService;
+import com.google.firebase.messaging.RemoteMessage;
+
import java.util.Map;
import de.pixart.messenger.Config;