diff --git a/HISTORY.md b/HISTORY.md index 7446b14..783e180 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -36,3 +36,4 @@ | 2.21 | Added 7 new devices (`edge1050`, `enduro3`, `fenix843mm`, `fenix847mm`, `fenix8solar47mm`, `fenix8solar51mm`, `fenixe`) and upgraded the SDK to 7.3.0. Fix for a bug on Edge devices introduced by v2.16 activity reporting improvements. | | 2.22 | Major feature release adding an optional PIN to menu items. This significant new feature has been provided by [moesterheld](https://github.com/moesterheld). Please do not rely on this application for security. Use at your own risk! | | 2.23 | Added "info" menu item for displaying information via a template without a tap or toggle. Essentially like the old 'template' type that was deprecated when all items were amended to display evaluated templates. That action removed the display only items too hastily. Added 5 new devices in the model range Instinct 3 and Instinct E. | +| 2.24 | Experiment to prevent new Webhook IDs being created unnecessarily. Reduced the latency for the first menu update. Added 4 new devices: approachs50, descentg2, descentmk1, and gpsmap66. | diff --git a/manifest.xml b/manifest.xml index 6974d01..6db0131 100644 --- a/manifest.xml +++ b/manifest.xml @@ -30,13 +30,14 @@ --> + @@ -46,6 +47,8 @@ + + @@ -113,6 +116,7 @@ + diff --git a/monkey.jungle b/monkey.jungle index 8add2a2..d10f4ed 100644 --- a/monkey.jungle +++ b/monkey.jungle @@ -34,6 +34,8 @@ project.manifest = manifest.xml # Icon 55 53 48 46 42 37 32 30 28 26 24 21 19 18 # Screen 480 454 416 390 360 320 280 260 240 218 208 176 166 156 +# Screen Size 390x390 launcher icon size 56x56 +approachs50.resourcePath = $(approachs50.resourcePath);resources-launcher-56-56;resources-icons-46 # Screen Size 390x390 launcher icon size 70x70 approachs7042mm.resourcePath = $(approachs7042mm.resourcePath);resources-launcher-70-70;resources-icons-46 # Screen Size 454x454 launcher icon size 80x80 @@ -50,6 +52,10 @@ d2deltas.resourcePath = $(d2deltas.resourcePath);resources-launcher-40-40;resour d2mach1.resourcePath = $(d2mach1.resourcePath);resources-launcher-60-60;resources-icons-48 # Screen Size 176x176 launcher icon size 62x62 descentg1.resourcePath = $(descentg1.resourcePath);resources-launcher-62-62;resources-icons-21 +# Screen Size 390x390 launcher icon size 60x60 +descentg2.resourcePath = $(descentg2.resourcePath);resources-launcher-60-60;resources-icons-46 +# Screen Size 240x240 launcher icon size 40x40 +descentmk1.resourcePath = $(descentmk1.resourcePath);resources-launcher-40-40;resources-icons-28 # Screen Size 280x280 launcher icon size 40x40 descentmk2.resourcePath = $(descentmk2.resourcePath);resources-launcher-40-40;resources-icons-32 # Screen Size 240x240 launcher icon size 40x40 @@ -164,6 +170,8 @@ fr955.resourcePath = $(fr955.resourcePath);resources-launcher-40-40;resources-ic # Screen Size 454x454 launcher icon size 65x65 fr965.resourcePath = $(fr965.resourcePath);resources-launcher-65-65;resources-icons-53 # Screen Size 240x400 launcher icon size 38x33 +gpsmap66.resourcePath = $(gpsmap66.resourcePath);resources-launcher-33-33;resources-icons-28 +# Screen Size 240x400 launcher icon size 38x33 gpsmap67.resourcePath = $(gpsmap67.resourcePath);resources-launcher-33-33;resources-icons-28 # Screen Size 176x176 launcher icon size 62x62 instinct2.resourcePath = $(instinct2.resourcePath);resources-launcher-62-62;resources-icons-21-w diff --git a/resources-launcher-56-56/drawables.xml b/resources-launcher-56-56/drawables.xml new file mode 100644 index 0000000..44c0b71 --- /dev/null +++ b/resources-launcher-56-56/drawables.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/resources-launcher-56-56/launcher.svg b/resources-launcher-56-56/launcher.svg new file mode 100644 index 0000000..3e43c22 --- /dev/null +++ b/resources-launcher-56-56/launcher.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/source/HomeAssistantApp.mc b/source/HomeAssistantApp.mc index ab437a3..230d630 100644 --- a/source/HomeAssistantApp.mc +++ b/source/HomeAssistantApp.mc @@ -39,7 +39,6 @@ class HomeAssistantApp extends Application.AppBase { private var mIsApp as Lang.Boolean = false; // Or Widget private var mUpdating as Lang.Boolean = false; // Don't start a second chain of updates private var mTemplates as Lang.Dictionary = {}; - private var startUpdating as Lang.Boolean = false; function initialize() { AppBase.initialize(); @@ -120,12 +119,16 @@ class HomeAssistantApp extends Application.AppBase { return ErrorView.create(WatchUi.loadResource($.Rez.Strings.NoInternet) as Lang.String); } else { var isCached = fetchMenuConfig(); + var ret = null; fetchApiStatus(); if (isCached) { - return [mHaMenu, new HomeAssistantViewDelegate(true)]; + ret = [mHaMenu, new HomeAssistantViewDelegate(true)]; } else { - return [new WatchUi.View(), new WatchUi.BehaviorDelegate()]; + ret = [new WatchUi.View(), new WatchUi.BehaviorDelegate()]; } + // Separated from Settings.update() in order to call after fetchMenuConfig() and not call it on changes settings. + Settings.webhook(); + return ret; } } @@ -263,17 +266,15 @@ class HomeAssistantApp extends Application.AppBase { private function buildMenu(menu as Lang.Dictionary) { mHaMenu = new HomeAssistantView(menu, null); mQuitTimer.begin(); - if (startUpdating) { - startUpdates(); - } + startUpdates(); } function startUpdates() { if (mHaMenu != null and !mUpdating) { // Start the continuous update process that continues for as long as the application is running. updateMenuItems(); + mUpdating = true; } - startUpdating = true; } function onReturnUpdateMenuItems(responseCode as Lang.Number, data as Null or Lang.Dictionary) as Void { diff --git a/source/Settings.mc b/source/Settings.mc index 0529fb4..ed29123 100644 --- a/source/Settings.mc +++ b/source/Settings.mc @@ -69,7 +69,9 @@ class Settings { mMenuAlignment = Properties.getValue("menu_alignment"); mIsSensorsLevelEnabled = Properties.getValue("enable_battery_level"); mBatteryRefreshRate = Properties.getValue("battery_level_refresh_rate"); + } + static function webhook() { if (System has :ServiceDelegate) { mHasService = true; } @@ -106,13 +108,13 @@ class Settings { unsetWebhookId(); } } - // System.println("Settings update(): getTemporalEventRegisteredTime() = " + Background.getTemporalEventRegisteredTime()); + // System.println("Settings webhook(): getTemporalEventRegisteredTime() = " + Background.getTemporalEventRegisteredTime()); // if (Background.getTemporalEventRegisteredTime() != null) { - // System.println("Settings update(): getTemporalEventRegisteredTime().value() = " + Background.getTemporalEventRegisteredTime().value().format("%d") + " seconds"); + // System.println("Settings webhook(): getTemporalEventRegisteredTime().value() = " + Background.getTemporalEventRegisteredTime().value().format("%d") + " seconds"); // } else { - // System.println("Settings update(): getTemporalEventRegisteredTime() = null"); + // System.println("Settings webhook(): getTemporalEventRegisteredTime() = null"); // } - } + } static function getApiKey() as Lang.String { return mApiKey; diff --git a/source/WebhookManager.mc b/source/WebhookManager.mc index b25380b..c44ccec 100644 --- a/source/WebhookManager.mc +++ b/source/WebhookManager.mc @@ -120,25 +120,21 @@ class WebhookManager { case Communications.BLE_HOST_TIMEOUT: case Communications.BLE_CONNECTION_UNAVAILABLE: // System.println("WebhookManager onReturnRegisterWebhookSensor() Response Code: BLE_HOST_TIMEOUT or BLE_CONNECTION_UNAVAILABLE, Bluetooth connection severed."); - Settings.unsetWebhookId(); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.NoPhone) as Lang.String); break; case Communications.BLE_QUEUE_FULL: // System.println("WebhookManager onReturnRegisterWebhookSensor() Response Code: BLE_QUEUE_FULL, API calls too rapid."); - Settings.unsetWebhookId(); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.ApiFlood) as Lang.String); break; case Communications.NETWORK_REQUEST_TIMED_OUT: // System.println("WebhookManager onReturnRegisterWebhookSensor() Response Code: NETWORK_REQUEST_TIMED_OUT, check Internet connection."); - Settings.unsetWebhookId(); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.NoResponse) as Lang.String); break; case Communications.NETWORK_RESPONSE_OUT_OF_MEMORY: // System.println("WebhookManager onReturnRegisterWebhookSensor() Response Code: NETWORK_RESPONSE_OUT_OF_MEMORY, are we going too fast?"); - Settings.unsetWebhookId(); // Ignore and see if we can carry on break;