Calendar trigger
This commit is contained in:
@ -628,9 +628,6 @@ public class Trigger
|
||||
if(!checkCalendarEvent(event, ignoreActive))
|
||||
continue;
|
||||
|
||||
//TODO: This line alone does not suffice and might also not be correct in some cases
|
||||
CalendarReceiver.addUsedPair(new CalendarReceiver.RuleEventPair(getParentRule(), event));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -137,6 +137,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
|
||||
}
|
||||
|
||||
clearCaches();
|
||||
calendarEventsUsed.clear();
|
||||
|
||||
calendarReceiverActive = false;
|
||||
}
|
||||
@ -599,7 +600,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean hasEventBeenUsedInRule(Rule rule, CalendarEvent event)
|
||||
public static boolean hasEventBeenUsedInRule(Rule rule, CalendarEvent event)
|
||||
{
|
||||
for (RuleEventPair executedPair : calendarEventsUsed)
|
||||
{
|
||||
@ -609,4 +610,32 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<CalendarReceiver.CalendarEvent> getApplyingCalendarEvents(Rule rule)
|
||||
{
|
||||
List<CalendarReceiver.CalendarEvent> returnList = new ArrayList<>();
|
||||
|
||||
try
|
||||
{
|
||||
List<CalendarReceiver.CalendarEvent> calendarEvents = CalendarReceiver.readCalendarEvents(AutomationService.getInstance(), true,false);
|
||||
|
||||
for(Trigger t : rule.getTriggerSet())
|
||||
{
|
||||
if(t.getTriggerType().equals(calendarEvents))
|
||||
{
|
||||
for (CalendarReceiver.CalendarEvent event : calendarEvents)
|
||||
{
|
||||
if (t.checkCalendarEvent(event, false))
|
||||
returnList.add(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "getApplyingCalendarEvents()", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
|
||||
return returnList;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user