show doze warning when push is running on prosody

This commit is contained in:
Daniel Gultsch 2017-01-12 23:22:02 +01:00
parent 1876b444fa
commit 8e025cbb9e
4 changed files with 10 additions and 2 deletions

View File

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

View File

@ -1498,7 +1498,7 @@ public class ConversationActivity extends XmppActivity
private boolean hasAccountWithoutPush() {
for(Account account : xmppConnectionService.getAccounts()) {
if (account.getStatus() != Account.State.DISABLED
&& !xmppConnectionService.getPushManagementService().available(account)) {
&& !xmppConnectionService.getPushManagementService().availableAndUseful(account)) {
return true;
}
}

View File

@ -836,7 +836,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) {
Features features = this.mAccount.getXmppConnection().getFeatures();
this.mStats.setVisibility(View.VISIBLE);
boolean showBatteryWarning = !xmppConnectionService.getPushManagementService().available(mAccount) && isOptimizingBattery();
boolean showBatteryWarning = !xmppConnectionService.getPushManagementService().availableAndUseful(mAccount) && isOptimizingBattery();
boolean showDataSaverWarning = isAffectedByDataSaver();
showOsOptimizationWarning(showBatteryWarning,showDataSaverWarning);
this.mSessionEst.setText(UIHelper.readableTimeDifferenceFull(this, this.mAccount.getXmppConnection()

View File

@ -106,6 +106,10 @@ public class PushManagementService {
return connection != null && connection.getFeatures().push() && playServicesAvailable();
}
public boolean availableAndUseful(Account account) {
return account.getServerIdentity() == XmppConnection.Identity.EJABBERD && available(account);
}
private boolean playServicesAvailable() {
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mXmppConnectionService) == ConnectionResult.SUCCESS;
}