aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-15 11:56:22 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-15 11:56:22 +0100
commitef114b76c1fd420339ec9f84c9538507d5fb7fbf (patch)
treeec2ef09de9afa07d0beee736822d93391178e0ea
parent233c1a1da7a1946bada25c86361de005672557b6 (diff)
show doze warning when push is running on prosody
-rw-r--r--src/free/java/de/pixart/messenger/services/PushManagementService.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java2
-rw-r--r--src/playstore/java/de/pixart/messenger/services/PushManagementService.java4
4 files changed, 10 insertions, 2 deletions
diff --git a/src/free/java/de/pixart/messenger/services/PushManagementService.java b/src/free/java/de/pixart/messenger/services/PushManagementService.java
index b76f5b4de..ca5ba6431 100644
--- a/src/free/java/de/pixart/messenger/services/PushManagementService.java
+++ b/src/free/java/de/pixart/messenger/services/PushManagementService.java
@@ -21,4 +21,8 @@ public class PushManagementService {
public boolean isStub() {
return true;
}
+
+ public boolean availableAndUseful(Account account) {
+ return false;
+ }
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index 4d9292b61..343d4f3ce 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -1786,7 +1786,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;
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index 97e788f1c..9b8a756c3 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -850,7 +850,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()
diff --git a/src/playstore/java/de/pixart/messenger/services/PushManagementService.java b/src/playstore/java/de/pixart/messenger/services/PushManagementService.java
index 9680a65c2..701eea6d2 100644
--- a/src/playstore/java/de/pixart/messenger/services/PushManagementService.java
+++ b/src/playstore/java/de/pixart/messenger/services/PushManagementService.java
@@ -104,6 +104,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;
}