feat: archer add print message

This commit is contained in:
Urko 2023-07-02 20:15:54 +02:00
parent cc9c9354bc
commit c09933767b
1 changed files with 9 additions and 0 deletions

View File

@ -75,6 +75,7 @@ func (p ArcherAx50) SwitchWIFI() error {
}) })
isChecked := checked.Value.Bool() isChecked := checked.Value.Bool()
log.Println(getCheckedMessage(isChecked))
p.page.MustEvaluate(&rod.EvalOptions{ p.page.MustEvaluate(&rod.EvalOptions{
JS: `() => { JS: `() => {
document.getElementById('` + p.chkWifi2gID + `').checked=` + fmt.Sprint(!isChecked) + `; document.getElementById('` + p.chkWifi2gID + `').checked=` + fmt.Sprint(!isChecked) + `;
@ -93,3 +94,11 @@ func (p ArcherAx50) SwitchWIFI() error {
time.Sleep(time.Millisecond * 1500) time.Sleep(time.Millisecond * 1500)
return nil return nil
} }
func getCheckedMessage(isChecked bool) string {
if isChecked {
return "Time to sleep, let's switch off"
}
return "Time to laborate, let's switch WIFI on"
}