Skip to content

Commit

Permalink
Added action 'Sync calendar'. Solving issue #3
Browse files Browse the repository at this point in the history
  • Loading branch information
runely committed Jun 16, 2020
1 parent 00927da commit 1a44342
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .homeycompose/flow/actions/sync-calendar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "sync-calendar",
"title": {
"en": "Sync calendar",
"no": "Synkroniser kalenderen"
},
"hint": {
"en": "Will download a new .ics file to update current events",
"no": "Henter ned en ny .ics-fil for å oppdatere nåværende avtaler"
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The IcalCalendar can trigger on your calendar events to let you know when events

- 0.0.5
- Added support for norwegian language -> [Issue #6](https://github.com/runely/calendar-homey/issues/6)
- Added action for Sync calendar -> [Issue #3](https://github.com/runely/calendar-homey/issues/3)
- 0.0.4
- Changelog moved out of readme...
- 0.0.3
Expand Down
13 changes: 12 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class IcalCalendar extends Homey.App {
// register condition flow cards
this.registerConditionFlowCards();

// register action flow cards
this.registerActionFlowCards();

// get ical
this.getEvents();

Expand Down Expand Up @@ -58,6 +61,14 @@ class IcalCalendar extends Homey.App {
.registerRunListener((args, state) => this.checkEvent(args, state, 'any_in'));
}

registerActionFlowCards() {
new Homey.FlowCardAction('sync-calendar')
.register()
.registerRunListener((args, state) => {
return Promise.resolve(this.getEvents());
})
}

onEventAutocomplete(query, args) {
if (!variableMgmt.EVENTS) {
this.log("onEventAutocomplete: Events not set yet. Nothing to show...");
Expand Down Expand Up @@ -125,7 +136,7 @@ class IcalCalendar extends Homey.App {
var settingName = args;
}
else {
this.log("getEvents: Called from onInit/cron");
this.log("getEvents: Called from onInit/cron/action");
var settingName = variableMgmt.SETTING.ICAL_URI;
}

Expand Down
13 changes: 13 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,19 @@
}
]
}
],
"actions": [
{
"id": "sync-calendar",
"title": {
"en": "Sync calendar",
"no": "Synkroniser kalenderen"
},
"hint": {
"en": "Will download a new .ics file to update current events",
"no": "Henter ned en ny .ics-fil for å oppdatere nåværende avtaler"
}
}
]
}
}

0 comments on commit 1a44342

Please sign in to comment.