diff --git a/resources-deu/strings/strings.xml b/resources-deu/strings/strings.xml
index f6a21d3..d0d9620 100644
--- a/resources-deu/strings/strings.xml
+++ b/resources-deu/strings/strings.xml
@@ -60,6 +60,7 @@
Zusätzliche Abfrageverzögerung (in Sekunden). Fügt eine Verzögerung zwischen der Statusaktualisierung aller Menüelemente hinzu.
Nach dieser Zeit (in Sekunden) wird der Bestätigungsdialog einer Aktion geschlossen und die
Aktion abgebrochen. Auf 0 setzen, um den Timeout zu deaktivieren.
+ Schablone um die PIN aus der Dashboard Config zu transkodieren.
Menüausrichtung links (aus) oder rechts (ein).
Links nach rechts
Rechts nach links
diff --git a/resources/settings/properties.xml b/resources/settings/properties.xml
index 06b7fbb..d57cd39 100644
--- a/resources/settings/properties.xml
+++ b/resources/settings/properties.xml
@@ -65,6 +65,14 @@
-->
3
+
+
+
diff --git a/resources/settings/settings.xml b/resources/settings/settings.xml
index 346ad84..ac03988 100644
--- a/resources/settings/settings.xml
+++ b/resources/settings/settings.xml
@@ -79,6 +79,13 @@
+
+
+
+
Timeout in seconds. Exit the application after this period of inactivity to save the device battery.
Additional poll delay (in seconds). Adds a delay between the status update of all menu items.
After this time (in seconds), a confirmation dialog for an action is automatically closed and the action is cancelled. Set to 0 to disable the timeout.
+ Integer Mask to transcode the plain text PIN from the public dashboard config.
Left (off) or Right (on) Menu Alignment.
Left to right
Right to Left
diff --git a/source/HomeAssistantPinConfirmation.mc b/source/HomeAssistantPinConfirmation.mc
index b2a5327..b818dd3 100644
--- a/source/HomeAssistantPinConfirmation.mc
+++ b/source/HomeAssistantPinConfirmation.mc
@@ -118,10 +118,17 @@ class HomeAssistantPinConfirmationDelegate extends WatchUi.BehaviorDelegate {
return true;
}
- function getTranscodedCurrentDigit() as Number {
- var currentDigit = mPin[mCurrentIndex].toString().toNumber(); // this is ugly, but apparently the only way for char<->number comparisons
- // TODO: Transcode digit using a pin mask for additional security
- return currentDigit;
+ function getTranscodedCurrentDigit() as Number or Null {
+ var currentDigit = mPin[mCurrentIndex].toString().toNumber(); // this is ugly, but apparently the only way for char<->number conversions
+ if (currentDigit == null) {
+ return null;
+ }
+ var pinMask = Settings.getPinMask();
+ var maskDigit = pinMask.substring(mCurrentIndex, mCurrentIndex+1).toNumber();
+ if (maskDigit == null) {
+ return currentDigit;
+ }
+ return ((currentDigit + maskDigit - 1) % 4) + 1;
}
function resetTimer() {
diff --git a/source/Settings.mc b/source/Settings.mc
index 1bb7520..3a4d9b7 100644
--- a/source/Settings.mc
+++ b/source/Settings.mc
@@ -38,6 +38,7 @@ class Settings {
private static var mAppTimeout as Lang.Number = 0; // seconds
private static var mPollDelay as Lang.Number = 0; // seconds
private static var mConfirmTimeout as Lang.Number = 3; // seconds
+ private static var mPinMask as Lang.String = "";
private static var mMenuAlignment as Lang.Number = WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT;
private static var mIsSensorsLevelEnabled as Lang.Boolean = false;
private static var mBatteryRefreshRate as Lang.Number = 15; // minutes
@@ -59,6 +60,7 @@ class Settings {
mAppTimeout = Properties.getValue("app_timeout");
mPollDelay = Properties.getValue("poll_delay_combined");
mConfirmTimeout = Properties.getValue("confirm_timeout");
+ mPinMask = Properties.getValue("pin_mask");
mMenuAlignment = Properties.getValue("menu_alignment");
mIsSensorsLevelEnabled = Properties.getValue("enable_battery_level");
mBatteryRefreshRate = Properties.getValue("battery_level_refresh_rate");
@@ -164,6 +166,10 @@ class Settings {
return mConfirmTimeout * 1000; // Convert to milliseconds
}
+ static function getPinMask() as Lang.String {
+ return mPinMask;
+ }
+
static function getMenuAlignment() as Lang.Number {
return mMenuAlignment; // Either WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_RIGHT or WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT
}