put address of app server in resource file

This commit is contained in:
Daniel Gultsch 2018-05-20 16:43:10 +02:00
parent 3be3bfb492
commit 219ca9f72b
2 changed files with 4 additions and 4 deletions

2
.gitignore vendored
View File

@ -2,7 +2,7 @@
*.swp
.settings
src/playstore/res/values/gcm.xml
src/playstore/res/values/push.xml
# https://github.com/github/gitignore/blob/master/Gradle.gitignore
.gradle/

View File

@ -7,6 +7,7 @@ import com.google.android.gms.common.GoogleApiAvailability;
import com.google.firebase.iid.FirebaseInstanceId;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.utils.PhoneHelper;
import eu.siacs.conversations.xml.Element;
@ -18,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) {
@ -30,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) {