Merge pull request #2791 from thyttan/runplus

[Runplus] Rebase on  'Run' app version 0.16
master
Gordon Williams 2023-06-05 09:45:06 +01:00 committed by GitHub
commit 992d4e736c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 23 deletions

View File

@ -14,4 +14,4 @@
0.13: Revert #1578 (stop duplicate entries) as with 2v12 menus it causes other boxes to be wiped (fix #1643)
0.14: Fix Bangle.js 1 issue where after the 'overwrite track' menu, the start/stop button stopped working
0.15: Keep run state between runs (allowing you to exit and restart the app)
0.16: Added ability to resume a run that was stopped previously (fix #1907)
0.16: Added ability to resume a run that was stopped previously (fix #1907)

View File

@ -13,10 +13,12 @@
0.12: Fix for recorder not stopping at end of run. Bug introduced in 0.11
0.13: Revert #1578 (stop duplicate entries) as with 2v12 menus it causes other boxes to be wiped (fix #1643)
0.14: Fix Bangle.js 1 issue where after the 'overwrite track' menu, the start/stop button stopped working
0.15: Diverge from the standard "Run" app. Swipe to intensity interface a la Karvonen (curtesy of FTeacher at https://github.com/f-teacher)
Keep run state between runs (allowing you to exit and restart the app)
0.16: Don't clear zone 2b indicator segment when updating HRM reading.
Write to correct settings file, fixing settings not working.
0.17: Fix typo in variable name preventing starting a run.
0.18: Tweak HRM min/max defaults. Extend min/max intervals in settings. Fix
another typo.
0.15: Keep run state between runs (allowing you to exit and restart the app)
0.16: Added ability to resume a run that was stopped previously (fix #1907)
0.17: Diverge from the standard "Run" app. Swipe to intensity interface a la Karvonen (curtesy of FTeacher at https://github.com/f-teacher)
0.18: Don't clear zone 2b indicator segment when updating HRM reading.
Write to correct settings file, fixing settings not working.
0.19: Fix typo in variable name preventing starting a run
0.20: Tweak HRM min/max defaults. Extend min/max intervals in settings. Fix
another typo.
0.21: Rebase on "Run" app ver. 0.16.

View File

@ -61,36 +61,47 @@ function setStatus(running) {
// Called to start/stop running
function onStartStop() {
let running = !exs.state.active;
let prepPromises = [];
var running = !exs.state.active;
var shouldResume = false;
var promise = Promise.resolve();
if (running && exs.state.duration > 10000) { // if more than 10 seconds of duration, ask if we should resume?
promise = promise.
then(() => {
isMenuDisplayed = true;
return E.showPrompt("Resume run?",{title:"Run"});
}).then(r => {
isMenuDisplayed=false;shouldResume=r;
});
}
// start/stop recording
// Do this first in case recorder needs to prompt for
// an overwrite before we start tracking exstats
if (settings.record && WIDGETS["recorder"]) {
if (running) {
isMenuDisplayed = true;
prepPromises.push(
WIDGETS["recorder"].setRecording(true).then(() => {
promise = promise.
then(() => WIDGETS["recorder"].setRecording(true, { force : shouldResume?"append":undefined })).
then(() => {
isMenuDisplayed = false;
layout.setUI(); // grab our input handling again
layout.forgetLazyState();
layout.render();
})
);
});
} else {
prepPromises.push(
WIDGETS["recorder"].setRecording(false)
promise = promise.then(
() => WIDGETS["recorder"].setRecording(false)
);
}
}
if (!prepPromises.length) // fix for Promise.all bug in 2v12
prepPromises.push(Promise.resolve());
Promise.all(prepPromises)
.then(() => {
promise = promise.then(() => {
if (running) {
exs.start();
if (shouldResume)
exs.resume()
else
exs.start();
} else {
exs.stop();
}

View File

@ -1,7 +1,7 @@
{
"id": "runplus",
"name": "Run+",
"version": "0.18",
"version": "0.21",
"description": "Displays distance, time, steps, cadence, pace and more for runners. Based on the Run app, but extended with additional screen for heart rate interval training.",
"icon": "app.png",
"tags": "run,running,fitness,outdoors,gps,karvonen,karvonnen",