Skip to content

Commit

Permalink
Merge pull request espruino#3431 from bobrippling/feat/run-noprompt
Browse files Browse the repository at this point in the history
runplus: add option to always resume
  • Loading branch information
thyttan authored Jun 4, 2024
2 parents 050cd91 + 3be97f8 commit 946d722
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/runplus/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ Write to correct settings file, fixing settings not working.
0.24: Add indicators for lock,gps and pulse to karvonen screen
0.25: Fix step count bug when runs are resumed after a long time
0.26: Add ability to zoom in on a single stat by tapping it
0.27: Allow setting to alway resume an activity
5 changes: 3 additions & 2 deletions apps/runplus/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let settings = Object.assign({
B5: "step",
B6: "caden",
paceLength: 1000,
alwaysResume: false,
notify: {
dist: {
value: 0,
Expand Down Expand Up @@ -64,10 +65,10 @@ function onStartStop() {
}

var running = !exs.state.active;
var shouldResume = false;
var shouldResume = settings.alwaysResume;
var promise = Promise.resolve();

if (running && exs.state.duration > 10000) { // if more than 10 seconds of duration, ask if we should resume?
if (!shouldResume && running && exs.state.duration > 10000) { // if more than 10 seconds of duration, ask if we should resume?
promise = promise.
then(() => {
screen = "menu";
Expand Down
2 changes: 1 addition & 1 deletion apps/runplus/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "runplus",
"name": "Run+",
"version": "0.26",
"version": "0.27",
"description": "Displays distance, time, steps, cadence, pace and more for runners. Based on the Run app, but extended with additional screens for heart rate interval training and individual stat focus.",
"icon": "app.png",
"tags": "run,running,fitness,outdoors,gps,karvonen,karvonnen",
Expand Down
8 changes: 8 additions & 0 deletions apps/runplus/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
B5: "step",
B6: "caden",
paceLength: 1000, // TODO: Default to either 1km or 1mi based on locale
alwaysResume: false,
notify: {
dist: {
increment: 0,
Expand Down Expand Up @@ -72,6 +73,13 @@
saveSettings();
}
};
menu[/*LANG*/"Always resume run"] = {
value : settings.alwaysResume,
onchange : v => {
settings.alwaysResume = v;
saveSettings();
},
};
var notificationsMenu = {
'< Back': function() { E.showMenu(menu) },
}
Expand Down

0 comments on commit 946d722

Please sign in to comment.