Initial solution

This commit is contained in:
Philip Abbey
2024-03-20 23:33:13 +00:00
parent eebf5c9dcd
commit cacd9f856f
6 changed files with 74 additions and 30 deletions

View File

@ -36,6 +36,7 @@ class Settings {
private static var mClearCache as Lang.Boolean = false;
private static var mVibrate as Lang.Boolean = false;
private static var mAppTimeout as Lang.Number = 0; // seconds
private static var mPollDelay as Lang.Number = 0; // milliseconds
private static var mConfirmTimeout as Lang.Number = 3; // seconds
private static var mMenuAlignment as Lang.Number = WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT;
private static var mIsBatteryLevelEnabled as Lang.Boolean = false;
@ -56,11 +57,18 @@ class Settings {
mClearCache = Properties.getValue("clear_cache");
mVibrate = Properties.getValue("enable_vibration");
mAppTimeout = Properties.getValue("app_timeout");
mPollDelay = Properties.getValue("poll_delay");
mConfirmTimeout = Properties.getValue("confirm_timeout");
mMenuAlignment = Properties.getValue("menu_alignment");
mIsBatteryLevelEnabled = Properties.getValue("enable_battery_level");
mBatteryRefreshRate = Properties.getValue("battery_level_refresh_rate");
// There's a minimum of 50 ms on Timer.Timers, so reset to 0 if too small.
if (mPollDelay < 50) { // milliseconds
mPollDelay = 0;
Properties.setValue("poll_delay", mPollDelay);
}
if (System has :ServiceDelegate) {
mHasService = true;
}
@ -138,6 +146,10 @@ class Settings {
return mAppTimeout * 1000; // Convert to milliseconds
}
static function getPollDelay() as Lang.Number {
return mPollDelay;
}
static function getConfirmTimeout() as Lang.Number {
return mConfirmTimeout * 1000; // Convert to milliseconds
}
@ -153,4 +165,5 @@ class Settings {
Background.deleteTemporalEvent();
}
}
}