Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wwarby committed Nov 4, 2023
1 parent 4bcc174 commit 233069a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ Code and ideas borrowed from [RunnersField by kpaumann](https://github.com/kopa/

<a name="changelog"></a>
## Changelog
- 1.6.1
- Fix a bug introduced by changes in 1.6.0
- 1.6.0
- Add support for new devices, update translations
- 1.5.1
Expand Down
17 changes: 10 additions & 7 deletions source-memoryGTE32K/WalkerView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ class WalkerView extends Ui.DataField {

// If the activity has restarted after "resume later", load previously stored steps values
if (info != null && info.elapsedTime > 0) {
steps = Application.Properties.getValue("as");
activityStepsAtPreviousLap = Application.Properties.getValue("ls");
var app = Application.getApp();
steps = app.getProperty("as");
activityStepsAtPreviousLap = app.getProperty("ls");
app = null;
if (steps == null) { steps = 0; }
if (lapSteps == null) { lapSteps = 0; }
// Consolidate the previously stored steps, otherwise we will lose them when steps are next calculated
Expand All @@ -110,30 +112,31 @@ class WalkerView extends Ui.DataField {
function readSettings() {

var deviceSettings = System.getDeviceSettings();
var app = Application.getApp();

// 12 / 24 hour mode
is24Hour = deviceSettings.is24Hour;

// Dark mode
darkModeFromSetting = Application.Properties.getValue("d") == true;
darkModeFromSetting = app.getProperty("d") == true;

// Speed / pace mode
paceOrSpeedMode = Application.Properties.getValue("pm");
paceOrSpeedMode = app.getProperty("pm");
if (paceOrSpeedMode > 0) {
paceOrSpeedData = new DataQueue(paceOrSpeedMode, true);
} else {
paceOrSpeedData = null;
}

heartRateMode = Application.Properties.getValue("hm");
heartRateMode = app.getProperty("hm");
if (heartRateMode > 0) {
heartRateData = new DataQueue(heartRateMode, true);
} else {
heartRateData = null;
}

showHeartRateZone = Application.Properties.getValue("z");
showSpeedInsteadOfPace = Application.Properties.getValue("s");
showHeartRateZone = app.getProperty("z");
showSpeedInsteadOfPace = app.getProperty("s");

kmOrMileInMetersDistance = deviceSettings.distanceUnits == System.UNIT_METRIC ? 1000.0f : 1609.34f;
kmOrMileInKmPace = deviceSettings.paceUnits == System.UNIT_METRIC ? 1.0f : 1.60934f;
Expand Down
5 changes: 3 additions & 2 deletions source/WalkerApp.mc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class WalkerApp extends App.AppBase {

function onStop(state) {
// Store current step counts for later usage (e.g., resume later)
Application.Properties.setValue("as", mainView.steps);
Application.Properties.setValue("ls", mainView.activityStepsAtPreviousLap);
var app = Application.getApp();
app.setProperty("as", mainView.steps);
app.setProperty("ls", mainView.activityStepsAtPreviousLap);
}

function onSettingsChanged() {
Expand Down

0 comments on commit 233069a

Please sign in to comment.