mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-06-17 11:58:30 +00:00
Update HomeAssistantMenuItem.mc
Review comments. Vibrate on tap, visual confirmation on receipt of response.
This commit is contained in:
@ -89,15 +89,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
|
|||||||
}
|
}
|
||||||
if (WatchUi has :showToast) {
|
if (WatchUi has :showToast) {
|
||||||
WatchUi.showToast(toast, null);
|
WatchUi.showToast(toast, null);
|
||||||
}
|
} else {
|
||||||
if (Attention has :vibrate) {
|
|
||||||
Attention.vibrate([
|
|
||||||
new Attention.VibeProfile(50, 100), // On for 100ms
|
|
||||||
new Attention.VibeProfile( 0, 100), // Off for 100ms
|
|
||||||
new Attention.VibeProfile(50, 100) // On for 100ms
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if (!(WatchUi has :showToast) && !(Attention has :vibrate)) {
|
|
||||||
new Alert({
|
new Alert({
|
||||||
:timeout => Globals.scAlertTimeout,
|
:timeout => Globals.scAlertTimeout,
|
||||||
:font => Graphics.FONT_MEDIUM,
|
:font => Graphics.FONT_MEDIUM,
|
||||||
@ -128,7 +120,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
|
|||||||
// ERROR: venu: Cannot find symbol ':substring' on type 'PolyType<Null or $.Toybox.Lang.Object>'.
|
// ERROR: venu: Cannot find symbol ':substring' on type 'PolyType<Null or $.Toybox.Lang.Object>'.
|
||||||
var id = mIdentifier as Lang.String;
|
var id = mIdentifier as Lang.String;
|
||||||
if (mService == null) {
|
if (mService == null) {
|
||||||
var url = (Properties.getValue("api_url") as Lang.String) + "/services/" + id.substring(0, id.find(".")) + "/" + id.substring(id.find(".")+1, id.length());
|
var url = (Properties.getValue("api_url") as Lang.String) + "/services/" + id.substring(0, id.find(".")) + "/" + id.substring(id.find(".")+1, null);
|
||||||
if (Globals.scDebug) {
|
if (Globals.scDebug) {
|
||||||
System.println("HomeAssistantMenuItem execScript() URL=" + url);
|
System.println("HomeAssistantMenuItem execScript() URL=" + url);
|
||||||
System.println("HomeAssistantMenuItem execScript() mIdentifier=" + mIdentifier);
|
System.println("HomeAssistantMenuItem execScript() mIdentifier=" + mIdentifier);
|
||||||
@ -154,6 +146,13 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
|
|||||||
method(:onReturnExecScript)
|
method(:onReturnExecScript)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (Attention has :vibrate) {
|
||||||
|
Attention.vibrate([
|
||||||
|
new Attention.VibeProfile(50, 100), // On for 100ms
|
||||||
|
new Attention.VibeProfile( 0, 100), // Off for 100ms
|
||||||
|
new Attention.VibeProfile(50, 100) // On for 100ms
|
||||||
|
]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Globals.scDebug) {
|
if (Globals.scDebug) {
|
||||||
System.println("HomeAssistantMenuItem execScript(): No Internet connection, skipping API call.");
|
System.println("HomeAssistantMenuItem execScript(): No Internet connection, skipping API call.");
|
||||||
|
Reference in New Issue
Block a user