mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-01 03:55:47 +02:00
Bangle.js: Fix calendar sync setting
This commit is contained in:
parent
7eb1fcdb52
commit
d75ae6b54d
@ -999,7 +999,10 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
* Handle "force_calendar_sync" packet
|
* Handle "force_calendar_sync" packet
|
||||||
*/
|
*/
|
||||||
private void handleCalendarSync(JSONObject json) throws JSONException {
|
private void handleCalendarSync(JSONObject json) throws JSONException {
|
||||||
if (!GBApplication.getPrefs().getBoolean("enable_calendar_sync", false)) return;
|
if (!getDevicePrefs().getBoolean("sync_calendar", false)) {
|
||||||
|
LOG.debug("Ignoring calendar sync request, sync is disabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
//pretty much like the updateEvents in CalendarReceiver, but would need a lot of libraries here
|
//pretty much like the updateEvents in CalendarReceiver, but would need a lot of libraries here
|
||||||
JSONArray ids = json.getJSONArray("ids");
|
JSONArray ids = json.getJSONArray("ids");
|
||||||
ArrayList<Long> idsList = new ArrayList<>(ids.length());
|
ArrayList<Long> idsList = new ArrayList<>(ids.length());
|
||||||
@ -1790,7 +1793,10 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAddCalendarEvent(CalendarEventSpec calendarEventSpec) {
|
public void onAddCalendarEvent(CalendarEventSpec calendarEventSpec) {
|
||||||
if (!GBApplication.getPrefs().getBoolean("enable_calendar_sync", false)) return;
|
if (!getDevicePrefs().getBoolean("sync_calendar", false)) {
|
||||||
|
LOG.debug("Ignoring add calendar event {}, sync is disabled", calendarEventSpec.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
String description = calendarEventSpec.description;
|
String description = calendarEventSpec.description;
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
// remove any HTML formatting
|
// remove any HTML formatting
|
||||||
@ -1825,7 +1831,10 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
@Override
|
@Override
|
||||||
public void onDeleteCalendarEvent(byte type, long id) {
|
public void onDeleteCalendarEvent(byte type, long id) {
|
||||||
// FIXME: CalenderReceiver will call this directly - can we somehow batch up delete calls and use deleteCalendarEvents?
|
// FIXME: CalenderReceiver will call this directly - can we somehow batch up delete calls and use deleteCalendarEvents?
|
||||||
if (!GBApplication.getPrefs().getBoolean("enable_calendar_sync", false)) return;
|
if (!getDevicePrefs().getBoolean("sync_calendar", false)) {
|
||||||
|
LOG.debug("Ignoring delete calendar event {}, sync is disabled", id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
JSONObject o = new JSONObject();
|
JSONObject o = new JSONObject();
|
||||||
o.put("t", "calendar-");
|
o.put("t", "calendar-");
|
||||||
@ -1838,8 +1847,11 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
/* Called when we need to get rid of multiple calendar events */
|
/* Called when we need to get rid of multiple calendar events */
|
||||||
public void deleteCalendarEvents(ArrayList<Long> ids) {
|
public void deleteCalendarEvents(ArrayList<Long> ids) {
|
||||||
if (!GBApplication.getPrefs().getBoolean("enable_calendar_sync", false)) return;
|
if (!getDevicePrefs().getBoolean("sync_calendar", false)) {
|
||||||
if (ids.size() > 0)
|
LOG.debug("Ignoring delete calendar events {}, sync is disabled", ids);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!ids.isEmpty())
|
||||||
try {
|
try {
|
||||||
JSONObject o = new JSONObject();
|
JSONObject o = new JSONObject();
|
||||||
o.put("t", "calendar-");
|
o.put("t", "calendar-");
|
||||||
|
Loading…
Reference in New Issue
Block a user