mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-06-02 03:16:07 +02:00
Garmin: Add setting to disable notifications
This commit is contained in:
parent
438bfa4cce
commit
dbebca5b6b
|
@ -36,12 +36,13 @@ public abstract class GarminCoordinator extends AbstractBLEDeviceCoordinator {
|
||||||
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
|
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
|
||||||
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
||||||
|
|
||||||
|
final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALLS_AND_NOTIFICATIONS);
|
||||||
|
notifications.add(R.xml.devicesettings_send_app_notifications);
|
||||||
|
|
||||||
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
|
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
|
||||||
connection.add(R.xml.devicesettings_high_mtu);
|
connection.add(R.xml.devicesettings_high_mtu);
|
||||||
|
|
||||||
if (getCannedRepliesSlotCount(device) > 0) {
|
if (getCannedRepliesSlotCount(device) > 0) {
|
||||||
final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALLS_AND_NOTIFICATIONS);
|
|
||||||
|
|
||||||
notifications.add(R.xml.devicesettings_garmin_default_reply_suffix);
|
notifications.add(R.xml.devicesettings_garmin_default_reply_suffix);
|
||||||
notifications.add(R.xml.devicesettings_canned_reply_16);
|
notifications.add(R.xml.devicesettings_canned_reply_16);
|
||||||
notifications.add(R.xml.devicesettings_canned_dismisscall_16);
|
notifications.add(R.xml.devicesettings_canned_dismisscall_16);
|
||||||
|
|
|
@ -66,6 +66,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||||
|
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_ALLOW_HIGH_MTU;
|
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_ALLOW_HIGH_MTU;
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_GARMIN_DEFAULT_REPLY_SUFFIX;
|
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_GARMIN_DEFAULT_REPLY_SUFFIX;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SEND_APP_NOTIFICATIONS;
|
||||||
|
|
||||||
|
|
||||||
public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommunicator.Callback {
|
public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommunicator.Callback {
|
||||||
|
@ -258,6 +259,13 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNotification(NotificationSpec notificationSpec) {
|
public void onNotification(NotificationSpec notificationSpec) {
|
||||||
|
if (!getDevicePrefs().getBoolean(PREF_SEND_APP_NOTIFICATIONS, true)) {
|
||||||
|
// FIXME: Instead of silently dropping the notification, use NotificationSubscriptionMessage
|
||||||
|
// to signal to the watch that they're disabled
|
||||||
|
LOG.debug("App notifications disabled - ignoring");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sendOutgoingMessage(notificationsHandler.onNotification(notificationSpec));
|
sendOutgoingMessage(notificationsHandler.onNotification(notificationSpec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user