Skip to content

Commit

Permalink
Merge pull request #3722 from randyheydon/master
Browse files Browse the repository at this point in the history
calendar: read events synchronized from Gadgetbridge
  • Loading branch information
bobrippling authored Feb 3, 2025
2 parents 9de824a + 00cd02b commit 88a7492
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/calendar/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
Display Widgets in menus
0.17: Load holidays before events so the latter is not overpainted
0.18: Minor code improvements
0.19: Read events synchronized from Gadgetbridge
10 changes: 8 additions & 2 deletions apps/calendar/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ const loadEvents = () => {
date.setSeconds(time.s);
return {date: date, msg: a.msg, type: "e"};
}));
// all events synchronized from Gadgetbridge
events = events.concat((require("Storage").readJSON("android.calendar.json",1) || []).map(a => {
// timestamp is in seconds, Date requires milliseconds
const date = new Date(a.timestamp * 1000);
return {date: date, msg: a.title, type: "e"};
}));
};

const loadSettings = () => {
Expand Down Expand Up @@ -221,8 +227,8 @@ const drawCalendar = function(date) {
}, []);
let i = 0;
g.setFont("8x12", fontSize);
for (y = 0; y < rowN - 1; y++) {
for (x = 0; x < colN; x++) {
for (let y = 0; y < rowN - 1; y++) {
for (let x = 0; x < colN; x++) {
i++;
const day = days[i];
const curMonth = day < 15 ? month+1 : day < 50 ? month-1 : month;
Expand Down
2 changes: 1 addition & 1 deletion apps/calendar/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "calendar",
"name": "Calendar",
"version": "0.18",
"version": "0.19",
"description": "Monthly calendar, displays holidays uploaded from the web interface and scheduled events.",
"icon": "calendar.png",
"screenshots": [{"url":"screenshot_calendar.png"}],
Expand Down

0 comments on commit 88a7492

Please sign in to comment.