1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-03 17:02:13 +01:00

Pixoo: Add setting to disable notifications

This commit is contained in:
José Rebelo 2023-12-23 21:51:54 +00:00
parent 4a7a201971
commit 1cfd00c924
3 changed files with 13 additions and 0 deletions

View File

@ -83,6 +83,8 @@ public class PixooCoordinator extends AbstractBLEDeviceCoordinator {
R.xml.devicesettings_screen_brightness,
R.xml.devicesettings_header_time,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_header_notifications,
R.xml.devicesettings_send_app_notifications,
R.xml.devicesettings_header_other,
R.xml.devicesettings_pixoo,
R.xml.devicesettings_header_connection,

View File

@ -216,6 +216,11 @@ public class PixooProtocol extends GBDeviceProtocol {
@Override
public byte[] encodeNotification(NotificationSpec notificationSpec) {
if (!getDevicePrefs().getBoolean(DeviceSettingsPreferenceConst.PREF_SEND_APP_NOTIFICATIONS, true)) {
LOG.debug("App notifications disabled - ignoring");
return null;
}
byte iconID;
switch (notificationSpec.type) {
case KAKAO_TALK:

View File

@ -22,6 +22,7 @@ import android.location.Location;
import java.util.ArrayList;
import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
@ -31,6 +32,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.model.Reminder;
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
import nodomain.freeyourgadget.gadgetbridge.model.WorldClock;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
public abstract class GBDeviceProtocol {
@ -178,4 +180,8 @@ public abstract class GBDeviceProtocol {
public byte[] encodeGpsLocation(Location location) {
return null;
}
protected Prefs getDevicePrefs() {
return new Prefs(GBApplication.getDeviceSpecificSharedPrefs(getDevice().getAddress()));
}
}