@@ -25,9 +25,10 @@ using Toybox.Application.Properties;
25
25
using Toybox .Timer ;
26
26
27
27
class HomeAssistantToggleMenuItem extends WatchUi .ToggleMenuItem {
28
- private var mConfirm as Lang.Boolean;
29
- private var mData as Lang.Dictionary;
30
- private var mTemplate as Lang.String;
28
+ private var mConfirm as Lang.Boolean;
29
+ private var mData as Lang.Dictionary;
30
+ private var mTemplate as Lang.String;
31
+ private var mHasVibrate as Lang.Boolean = false ;
31
32
32
33
function initialize (
33
34
label as Lang .String or Lang .Symbol ,
@@ -40,6 +41,9 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
40
41
} or Null
41
42
) {
42
43
WatchUi .ToggleMenuItem .initialize (label , null , null , false , options );
44
+ if (Attention has :vibrate ) {
45
+ mHasVibrate = true ;
46
+ }
43
47
mConfirm = confirm ;
44
48
mData = data ;
45
49
mTemplate = template ;
@@ -198,6 +202,13 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
198
202
},
199
203
method (:onReturnSetState )
200
204
);
205
+ if (mHasVibrate and Settings .getVibrate ()) {
206
+ Attention .vibrate ([
207
+ new Attention .VibeProfile (50 , 100 ), // On for 100ms
208
+ new Attention .VibeProfile ( 0 , 100 ), // Off for 100ms
209
+ new Attention .VibeProfile (50 , 100 ) // On for 100ms
210
+ ]);
211
+ }
201
212
}
202
213
}
203
214
0 commit comments