mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-27 19:15:50 +01:00
Xiaomi: Allow disabling app notifications per device
This commit is contained in:
parent
f29995b571
commit
6479cc3bb0
@ -390,6 +390,7 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
settings.add(R.xml.devicesettings_display_caller);
|
settings.add(R.xml.devicesettings_display_caller);
|
||||||
settings.add(R.xml.devicesettings_vibrationpatterns);
|
settings.add(R.xml.devicesettings_vibrationpatterns);
|
||||||
settings.add(R.xml.devicesettings_donotdisturb_withauto_and_always);
|
settings.add(R.xml.devicesettings_donotdisturb_withauto_and_always);
|
||||||
|
settings.add(R.xml.devicesettings_send_app_notifications);
|
||||||
settings.add(R.xml.devicesettings_screen_on_on_notifications);
|
settings.add(R.xml.devicesettings_screen_on_on_notifications);
|
||||||
settings.add(R.xml.devicesettings_autoremove_notifications);
|
settings.add(R.xml.devicesettings_autoremove_notifications);
|
||||||
if (getCannedRepliesSlotCount(device) > 0) {
|
if (getCannedRepliesSlotCount(device) > 0) {
|
||||||
|
@ -35,6 +35,7 @@ import java.util.Locale;
|
|||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventNotificationControl;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventNotificationControl;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
|
||||||
@ -117,6 +118,11 @@ public class XiaomiNotificationService extends AbstractXiaomiService implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onNotification(final NotificationSpec notificationSpec) {
|
public void onNotification(final NotificationSpec notificationSpec) {
|
||||||
|
if (!getDevicePrefs().getBoolean(DeviceSettingsPreferenceConst.PREF_SEND_APP_NOTIFICATIONS, true)) {
|
||||||
|
LOG.debug("App notifications disabled - ignoring");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final XiaomiProto.Notification3.Builder notification3 = XiaomiProto.Notification3.newBuilder()
|
final XiaomiProto.Notification3.Builder notification3 = XiaomiProto.Notification3.newBuilder()
|
||||||
.setId(notificationSpec.getId())
|
.setId(notificationSpec.getId())
|
||||||
.setUnknown4("") // ?
|
.setUnknown4("") // ?
|
||||||
@ -175,6 +181,11 @@ public class XiaomiNotificationService extends AbstractXiaomiService implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onDeleteNotification(final int id) {
|
public void onDeleteNotification(final int id) {
|
||||||
|
if (!getDevicePrefs().getBoolean(DeviceSettingsPreferenceConst.PREF_SEND_APP_NOTIFICATIONS, true)) {
|
||||||
|
LOG.debug("App notifications disabled - ignoring delete");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user