Makes alarm_control_panels more flexible on Android auto#6374
Makes alarm_control_panels more flexible on Android auto#6374poupounetjoyeux wants to merge 5 commits intohome-assistant:mainfrom
Conversation
If alarm has code but not required for arming allows arming alarm Keep the logic for disarming regarding the has code Move the logic inside Entity.kt
There was a problem hiding this comment.
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
|
Please sign the CLA to proceed. At a quick glance your check in |
common/src/main/kotlin/io/homeassistant/companion/android/common/data/integration/Entity.kt
Fixed
Show fixed
Hide fixed
common/src/main/kotlin/io/homeassistant/companion/android/common/data/integration/Entity.kt
Fixed
Show fixed
Hide fixed
common/src/main/kotlin/io/homeassistant/companion/android/common/data/integration/Entity.kt
Fixed
Show fixed
Hide fixed
|
Hello @jpelgrom, |
b739402 to
78a971f
Compare
Move methods to an util class to make them simpler to test Fix reversed condition in alarmCanBeArmedWithoutCode()
|
Hello! The change is now ready and tested |
| gridItem.setLoading(entity.isExecuting()) | ||
| } else { | ||
| if (entity.domain !in NOT_ACTIONABLE_DOMAINS || canNavigate(entity) || alarmHasNoCode(entity)) { | ||
| if (entity.domain !in NOT_ACTIONABLE_DOMAINS || canNavigate(entity)) { |
There was a problem hiding this comment.
When it is not possible to interact with an entity, there should be no click listener at all.
Otherwise this can result in users not knowing why nothing is happening when they tap on it and the UI shows it was tapped, unlike other entities you cannot interact with. It also creates accessibility problems as it appears interactable while it's not.
There was a problem hiding this comment.
I like the idea of adding these to a different file (Entity.kt is very long), but maybe consider
- putting it in the same package as Entity.kt as it all requires one
- consider making it extension functions so it is more like the other functions 'from outside'
There was a problem hiding this comment.
Don't know if the new place is OK for you?
| import org.junit.jupiter.api.Assertions.assertEquals | ||
| import org.junit.jupiter.api.Test | ||
|
|
||
| class AlarmControlPanelEntityTest { |
There was a problem hiding this comment.
Try to rewrite your test titles using given, when, then structure.
Add some methods for more reliability
Summary
If alarm has code but not required for arming allows arming alarm (arm_away)
Impact only Android Auto part of the application
Checklist