fixed compile bug in free version

This commit is contained in:
Daniel Gultsch 2016-02-13 00:03:57 +01:00
parent 6217e33a87
commit c7a14092a8
5 changed files with 15 additions and 9 deletions

View File

@ -14,7 +14,7 @@ public class PushManagementService {
//stub implementation. only affects playstore flavor //stub implementation. only affects playstore flavor
} }
public boolean available() { public boolean available(Account account) {
return false; return false;
} }
} }

View File

@ -259,7 +259,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
fetchRosterFromServer(account); fetchRosterFromServer(account);
fetchBookmarks(account); fetchBookmarks(account);
sendPresence(account); sendPresence(account);
if (mPushManagementService.pushAvailable(account)) { if (mPushManagementService.available(account)) {
mPushManagementService.registerPushTokenOnServer(account); mPushManagementService.registerPushTokenOnServer(account);
} }
mMessageArchiveService.executePendingQueries(account); mMessageArchiveService.executePendingQueries(account);
@ -2856,7 +2856,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
private void refreshAllGcmTokens() { private void refreshAllGcmTokens() {
for(Account account : getAccounts()) { for(Account account : getAccounts()) {
if (account.isOnlineAndConnected() && mPushManagementService.pushAvailable(account)) { if (account.isOnlineAndConnected() && mPushManagementService.available(account)) {
mPushManagementService.registerPushTokenOnServer(account); mPushManagementService.registerPushTokenOnServer(account);
} }
} }

View File

@ -686,7 +686,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
this.mServerInfoHttpUpload.setText(R.string.server_info_unavailable); this.mServerInfoHttpUpload.setText(R.string.server_info_unavailable);
} }
this.mPushRow.setVisibility(xmppConnectionService.getPushManagementService().available() ? View.VISIBLE : View.GONE); this.mPushRow.setVisibility(xmppConnectionService.getPushManagementService().available(mAccount) ? View.VISIBLE : View.GONE);
if (features.push()) { if (features.push()) {
this.mServerInfoPush.setText(R.string.server_info_available); this.mServerInfoPush.setText(R.string.server_info_available);

View File

@ -20,7 +20,7 @@ import eu.siacs.conversations.xmpp.stanzas.IqPacket;
public class PushManagementService { public class PushManagementService {
private static final String APP_SERVER = "push.conversations.im"; private static final String APP_SERVER = "push.siacs.eu";
protected final XmppConnectionService mXmppConnectionService; protected final XmppConnectionService mXmppConnectionService;
@ -64,12 +64,13 @@ public class PushManagementService {
} }
public boolean available() {
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mXmppConnectionService) == ConnectionResult.SUCCESS; public boolean available(Account account) {
return account.getXmppConnection().getFeatures().push() && playServicesAvailable();
} }
public boolean pushAvailable(Account account) { private boolean playServicesAvailable() {
return account.getXmppConnection().getFeatures().push() && available(); return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mXmppConnectionService) == ConnectionResult.SUCCESS;
} }
interface OnGcmInstanceTokenRetrieved { interface OnGcmInstanceTokenRetrieved {

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="gcm_defaultSenderId" translatable="false">159709679736</string>
<string name="google_app_id">1:159709679736:android:a61b47ae910a1ad7</string>
</resources>