BangleApps/apps/activityreminder/app.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

function drawAlert() {
E.showPrompt("Inactivity detected", {
title: "Activity reminder",
buttons: { "Ok": 1, "Dismiss": 2, "Pause": 3 }
}).then(function (v) {
if (v == 1) {
activityreminder_data.okDate = new Date();
}
if (v == 2) {
activityreminder_data.dismissDate = new Date();
}
if (v == 3) {
activityreminder_data.pauseDate = new Date();
}
activityreminder.saveData(activityreminder_data);
2022-04-07 17:19:42 +00:00
load();
});
// Obey system quiet mode:
if (!(storage.readJSON('setting.json', 1) || {}).quiet) {
Bangle.buzz(400);
}
setTimeout(load, 20000);
2022-04-07 17:19:42 +00:00
}
2022-04-07 16:16:51 +00:00
function run() {
if (activityreminder.mustAlert(activityreminder_data, activityreminder_settings)) {
drawAlert();
} else {
eval(storage.read("activityreminder.settings.js"))(() => load());
}
2022-04-07 17:19:42 +00:00
}
const activityreminder = require("activityreminder");
const storage = require("Storage");
2022-04-07 17:19:42 +00:00
g.clear();
Bangle.loadWidgets();
Bangle.drawWidgets();
const activityreminder_settings = activityreminder.loadSettings();
const activityreminder_data = activityreminder.loadData();
2022-04-18 15:02:20 +00:00
run();