Skip to content

Commit

Permalink
don't try to add battery message if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrya committed Oct 24, 2020
1 parent 1a93fb5 commit 1e2845c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.ostrya.presencepublisher.ui.preference.condition.SendOfflineMessagePreference.SEND_OFFLINE_MESSAGE;
import static org.ostrya.presencepublisher.ui.preference.condition.SendViaMobileNetworkPreference.SEND_VIA_MOBILE_NETWORK;
import static org.ostrya.presencepublisher.ui.preference.schedule.LastSuccessTimestampPreference.LAST_SUCCESS;
import static org.ostrya.presencepublisher.ui.preference.schedule.SendBatteryMessagePreference.SEND_BATTERY_MESSAGE;

public class Publisher {
private static final String TAG = "Publisher";
Expand Down Expand Up @@ -83,7 +84,7 @@ private List<Message> getMessagesToSend() {
if (result.isEmpty() && sharedPreferences.getBoolean(SEND_OFFLINE_MESSAGE, false)) {
result.addAll(offlineMessageProvider.getMessages());
}
if (!result.isEmpty()) {
if (!result.isEmpty() && sharedPreferences.getBoolean(SEND_BATTERY_MESSAGE, false)) {
result.addAll(batteryMessageProvider.getMessages());
}
return Collections.unmodifiableList(result);
Expand Down

0 comments on commit 1e2845c

Please sign in to comment.