fixed server info push not showing up when unavailable

This commit is contained in:
Daniel Gultsch 2016-02-14 18:19:11 +01:00
parent 92a6e956fd
commit 356199978e
3 changed files with 12 additions and 4 deletions

View File

@ -17,4 +17,8 @@ public class PushManagementService {
public boolean available(Account account) { public boolean available(Account account) {
return false; return false;
} }
public boolean isStub() {
return true;
}
} }

View File

@ -686,9 +686,9 @@ 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(mAccount) ? View.VISIBLE : View.GONE); this.mPushRow.setVisibility(xmppConnectionService.getPushManagementService().isStub() ? View.GONE : View.VISIBLE);
if (features.push()) { if (xmppConnectionService.getPushManagementService().available(mAccount)) {
this.mServerInfoPush.setText(R.string.server_info_available); this.mServerInfoPush.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoPush.setText(R.string.server_info_unavailable); this.mServerInfoPush.setText(R.string.server_info_unavailable);

View File

@ -76,9 +76,9 @@ public class PushManagementService {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
if (packet.getType() == IqPacket.TYPE.RESULT) { if (packet.getType() == IqPacket.TYPE.RESULT) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": successfully enabled push on server"); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": successfully enabled push on server");
} else if (packet.getType() == IqPacket.TYPE.ERROR) { } else if (packet.getType() == IqPacket.TYPE.ERROR) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": enabling push on server failed"); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": enabling push on server failed");
} }
} }
}); });
@ -109,6 +109,10 @@ public class PushManagementService {
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mXmppConnectionService) == ConnectionResult.SUCCESS; return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mXmppConnectionService) == ConnectionResult.SUCCESS;
} }
public boolean isStub() {
return false;
}
interface OnGcmInstanceTokenRetrieved { interface OnGcmInstanceTokenRetrieved {
void onGcmInstanceTokenRetrieved(String token); void onGcmInstanceTokenRetrieved(String token);
} }