From 6e566c664d499ab59ed45add7341306b73196cbe Mon Sep 17 00:00:00 2001 From: Jens Date: Mon, 8 Jan 2024 23:10:27 +0100 Subject: [PATCH] Calendar trigger --- app/src/main/java/com/jens/automation2/Action.java | 3 ++- .../jens/automation2/receivers/CalendarReceiver.java | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/jens/automation2/Action.java b/app/src/main/java/com/jens/automation2/Action.java index 0c18539..def6b93 100644 --- a/app/src/main/java/com/jens/automation2/Action.java +++ b/app/src/main/java/com/jens/automation2/Action.java @@ -700,7 +700,8 @@ public class Action } private void triggerUrl(Context context) - { + { + //TODO: Check if data needs to be escaped String username = null; String password = null; String method = ActivityManageActionTriggerUrl.methodGet; diff --git a/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java b/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java index 5e331d6..0bf3fac 100644 --- a/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java +++ b/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java @@ -84,9 +84,11 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis @Override public void onReceive(Context context, Intent intent) { + Miscellaneous.logEvent("i", "CalendarReceiver", "Received " + intent.getAction(), 4); + if(intent.getAction().equalsIgnoreCase(Intent.ACTION_PROVIDER_CHANGED)) { - Miscellaneous.logEvent("i", "CalendarReceiver", "Received " + intent.getAction(), 5); + Miscellaneous.logEvent("i", "CalendarReceiver", "Clearing calendar caches.", 4); calendarsCache = null; calendarEventsCache = null; @@ -97,7 +99,6 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis } else if(intent.getAction().equalsIgnoreCase(calendarAlarmAction)) { - Miscellaneous.logEvent("i", "CalendarReceiver", "Received alarm for calendar receiver.", 5); routineAtAlarm(); } } @@ -357,15 +358,12 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis CalendarContract.Instances.ALL_DAY, CalendarContract.Instances.BEGIN, CalendarContract.Instances.END, -// CalendarContract.Instances.DTSTART, -// CalendarContract.Instances.DTEND, CalendarContract.Instances.EVENT_LOCATION, CalendarContract.Instances.AVAILABILITY }, null, null, null); cursor.moveToFirst(); - // fetching calendars name String CNames[] = new String[cursor.getCount()]; Calendar now = Calendar.getInstance(); @@ -499,7 +497,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis if (events.size() == 0) { - Miscellaneous.logEvent("i", "calculateNextWakeup()", "No future events, nothing to schedule.", 5); + Miscellaneous.logEvent("i", "calculateNextWakeup()", "No future events, nothing to schedule.", 4); } else {