Commit graph

908 commits

Author SHA1 Message Date
leroyboerefijn 131296ad01
Show names on shortcuts tile (#2142)
* Show names on shortcuts tile

* Reorganize shortcuts tile settings
2022-01-17 20:11:47 -05:00
Tiger Oakes 26f700bab2
Use getSystemService extension from Core KTX (#2136)
* Use getSystemService extension from Core KTX

* Replace deprecated bluetooth calls
2022-01-17 20:08:23 -05:00
Joris Pelgröm 050d449ef2
Support MFA during Wear OS standalone login (#2131)
* Initial Wear MFA support

 - Added support for authentication with MFA to the Wear OS login flow
 - Renamed the existing Authentication* stuff to PasswordAuthentication*
 - For the authentication flow, specify a base class used for responses and depending on the response return the appropriate data class that extends the base class

* Add MFA screens

  - Adjusting the existing view to add a new title and input and showing/hiding based on state created a buggy experience on the emulator where the keyboard confirm/next buttons didn't work properly any more, so the MFA input is a full new activity. Copied from the existing activity for username/password.

* Fix MFA activity tools:context

* Move MFA in to the existing AuthenticationActivity

 - Actually it is possible to get the MFA input in the same activity with a little effort, but the end result works great and doesn't use as much duplicate code

* Remove MFA activity, rename PasswordAuthentication* back

 - Remove the MFA activity now that MFA is integrated into the other activity for authentication
 - Rename back PasswordAuthentication* to Authentication* (end result compared to existing app: no change)

* Remove unnecessary JsonIgnoreProperties annotation
2022-01-17 20:01:57 -05:00
dependabot[bot] 8a8772d5e7
Bump android-junit5 from 1.8.1.0 to 1.8.2.0 (#2140)
Bumps [android-junit5](https://github.com/mannodermaus/android-junit5) from 1.8.1.0 to 1.8.2.0.
- [Release notes](https://github.com/mannodermaus/android-junit5/releases)
- [Commits](https://github.com/mannodermaus/android-junit5/compare/plugin-1.8.1.0...plugin-1.8.2.0)

---
updated-dependencies:
- dependency-name: de.mannodermaus.gradle.plugins:android-junit5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-13 15:12:43 -05:00
leroyboerefijn 3a15c0fb33
Template tile for wear OS (#2122)
* Initial implementation of template tile

Includes settings on phone and watch. Watch settings will be removed in next commit

* Add refresh interval setting to wear app

* Update wear settings layout

* Add interval setting to phone app

* ktlint

* Add example image to the manifest

* Add preview of rendered template in phone settings

* Process review comments

* Use resources for interval strings
2022-01-13 15:04:10 -05:00
Joris Pelgröm 70e6207a04
Support button entity type for device controls (#2134)
- Add support for entities in the new button domain (2021.12) and input_button domain (2022.2) to device controls
 - Rename the existing SceneControl as that already acted as a button
2022-01-11 21:39:44 -05:00
Joris Pelgröm cb88b659d3
Remove unused properties from device/entity registry response (#2130)
- This should fix issues users are seeing where deserialization fails because of an unexpected property type in the response
2022-01-11 21:29:22 -05:00
SkechyWolf b78c01d18b
Add Mount State sensor to the Quest (#2128)
* Add Mount State sensor to Quest

* Review commit

* Change Name and Description
2022-01-11 21:28:40 -05:00
Joris Pelgröm 4796284169
Add areas to entity list on Wear (#2118)
* First area implementation for Wear

* Fix import / ktlint

* Area IDs are only nullable in core, not for clients

* A new approach to managing the entity lists

 - Change the approach to getting state lists to support any number of lists per type. By nesting a state list inside the list Compose should still be able to update on any changes. To display, loop through the items.
 - The main view model now filters the main/source entity list that is used everywhere by supported entities to prevent unusable domains from showing up.
 - Fix padding above all entities/settings to make sure that there is still padding even if there are no entities.
 - Temporary fix for favorites/tiles: hardcode the lists used. Should be updated to read items dynamically but I couldn't get the rememberSaveable to work in time.

* Filter entities in EntityListView to keep live updates

 - Keep the updates in the EntityListView always live by allowing filtering the list in the view itself. Without these changes, selecting any domain from the main screen would give a static list because filtering creates a copy of the original.
 - Fix ktlint import ordering

* Listen for registry updates in the main list

 - Subscribe to events for registry updates and update any lists. Compose will take care of updating views if necessary, which basically makes this plug and play.

* Load entities for favorites+tiles dynamically

 - Load all the entities by domain when setting favorites or tiles, instead of using hardcoded references to specific domains. This is a proper fix for the updated list structure introduced in a previous commit.
 - Reuse saving the expanded states of lists from EntityListView because favorites and tiles can now also be any number of headers

* Fix 'All entities' icon filter

* Move names for supported domains

 - For determining which tiles are toggleable we already access the implementation directly so remove todos and move names for those domains over to the implementation to keep everything in one place. The main view model will include a simple function to convert the string ID to an actual string.

* Order area/domain lists alphabetically

 - Create a new observable list that can be used to determine the order in which to display the list or areas/entities. A mutableMapOf in Kotlin by default respects the insert order but it looks like the mutableStateMapOf doesn't follow that as the items are already inserted alphabetically.
 - Allow passing in a list order for the EntityListView to prevent entities from suddenly ending up in a different place on a different screen

* Order entities in area, util object for area

 - Order the list of entities displayed in one area alphabetically by their friendly name instead of domain, as it would otherwise still use domains internally to sort but not show them which is not a good experience.
 - Create an util object in the common package for getting the area of an entity, as the same code was used both in the device controls and Wear main list.

* Restore domain descriptions to original (plural)
2022-01-11 21:26:12 -05:00
Daniel Shokouhi b7e4fb7b9b
Set the GLES version for quest variant (#2117) 2022-01-05 17:48:01 -08:00
dependabot[bot] bfaecb7837
Bump com.github.ben-manes.versions from 0.40.0 to 0.41.0 (#2111)
Bumps com.github.ben-manes.versions from 0.40.0 to 0.41.0.

---
updated-dependencies:
- dependency-name: com.github.ben-manes.versions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-05 16:05:03 -05:00
Daniel Shokouhi 41cd94840d
Quest changes round 1 (#2110)
* Update manifest per Quest specifications, hide fmore features that are no longer usable due to changes

* Remove unused imports

* Hide more location based features
2022-01-05 16:04:50 -05:00
Daniel Shokouhi 0cb53fa3fb
Add the actual URL to the authentication calls (#2115) 2022-01-05 16:03:36 -05:00
Joris Pelgröm b409b90f82
Less duplicate code for classes implementing HaControl (#2109)
- Refactor HaControl to include a default implementation of the createControl function, add functions to provide class-specific information and features
2022-01-04 19:35:18 -05:00
Daniel Shokouhi eede556a77
Initial commit of the Quest build (#2106)
* Initial commit of the Quest build

* Tweak readme
2022-01-04 19:32:45 -05:00
Daniel Shokouhi e2d8e51792
Set the last high accuracy mode variable when enabled/disabled via notification command (#2105) 2022-01-04 19:32:27 -05:00
Justin Bassett 18453a1297 Fix publish error. 2022-01-04 18:31:20 -05:00
Daniel Shokouhi 4ce51f50c5
Show the location section during onboarding only if user is on the full flavor (#2101) 2022-01-02 13:55:17 -05:00
zmarties 43b53923ab
Add a work profile sensor (#2026)
* Add a work profile sensor

The information on whether the work profile is available only seems to
be given by tracking the state of the last received broadcast intent
indication - MANAGED_PROFILE_[UN]AVAILABLE

Thus add a receiver for these intents, and slightly change the architecture
so that the intent can be passed down when the sensor needs to be updated.

I think there's a ineffciency in the architecture - currently all
sensors are asked to update whenever any broadcast the app tracks is
received, regardless of whether than broadcast is relevant to the the
sensor or now - for example all sensors update when battery state changes.

* Revert typo fix to keep this PR focused.

* Pass lint checks
2021-12-31 07:53:07 -05:00
dependabot[bot] 75073ef764
Bump com.github.ben-manes.versions from 0.39.0 to 0.40.0 (#2099)
Bumps com.github.ben-manes.versions from 0.39.0 to 0.40.0.

---
updated-dependencies:
- dependency-name: com.github.ben-manes.versions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-31 07:47:03 -05:00
Daniel Shokouhi 37fdeb8192
Fix allow list in notification sensors (#2097) 2021-12-31 07:46:37 -05:00
Joris Pelgröm 7a7984964c
Group device controls by area first, if set (#2094)
- Set the device's zone to the area if present, else set to domain.
 - Android groups device controls by the zone that is set, in order of the first encountered zones. So make sure that we first emit devices by area a-z, and then in the list order (domain a-z).
2021-12-31 07:46:02 -05:00
Daniel Shokouhi 02e4efeb9f
Catch the failure on devices without rotary input (#2092) 2021-12-31 07:41:34 -05:00
Justin Bassett 476bd8984a
Work on error handling from Websocket. (#2091)
* Work on error handling from Websocket.

* Fix wear build.
2021-12-30 15:55:35 -05:00
Joris Pelgröm 5711e0e1b2
Widgets: use received entity state changes for updating if possible (#2089)
* Add entity state changed function to widgets

 - Add a function to widgets implementing the BaseWidgetProvider that is called whenever a new state change for an entity is received. Implemented it by refreshing all widgets (match existing behaviour).

* Use state update in widget if there's a widget for the entity

 - Only refresh the entity and media widget if the state of the entity they're displaying is changed. For the template widget we don't know since it is rendered on the server so just keep refreshing on any state change (no change).
 - Allow passing in a suggested entity for updating the view to allow the widgets to re-use the received state update object, removing the need to make another API call if the view is requested as a result from a state update.
2021-12-30 09:43:55 -05:00
Daniel Shokouhi 921820fe51
Add debug logging in quick setting tiles for easier troubleshooting (#2088) 2021-12-29 13:30:32 -05:00
Daniel Shokouhi 9eeb431aa1
Add last used app sensor (#2080)
* Add last used app sensor

* Use app label for state if possible

* Update string for new state logic

* Review comments

* Review comment

* Update app/src/main/java/io/homeassistant/companion/android/sensors/LastAppSensorManager.kt

Co-authored-by: Justin Bassett <bassett.justint@gmail.com>

* Lint

* Lint again

Co-authored-by: Justin Bassett <bassett.justint@gmail.com>
2021-12-29 13:04:47 -05:00
dependabot[bot] 16f1d4894f
Bump org.jlleitschuh.gradle.ktlint from 10.2.0 to 10.2.1 (#2084)
Bumps org.jlleitschuh.gradle.ktlint from 10.2.0 to 10.2.1.

---
updated-dependencies:
- dependency-name: org.jlleitschuh.gradle.ktlint
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-28 09:04:06 -05:00
Justin Bassett 8011d763e0
Update Release Workflow (#2081)
Ensure that we upload a release version of the wear apk along with publishing a text document with the version code.
2021-12-28 09:03:52 -05:00
Joris Pelgröm b7d0ae7b2a
Check if there are any widgets before connecting to websocket (#2079) 2021-12-26 20:56:20 -05:00
SkechyWolf 99a7ca1e56
Exit app when back is pressed on Screen_Landing (#2077)
* Exit app when back is pressed on Sreen_Landing

* Fix imports
2021-12-26 20:55:36 -05:00
Joris Pelgröm 4a51a86456
Add area/device/entity registry in order to show area on device controls (#2027)
* Read registries using websocket, show in Controls

 - Quick first implementation of reading area/device/entity registries via websocket
 - Use these registries when loading Android's device controls to display the area in the subtitle on load

* Move data classes to websocket package

 - Merge the general and response data classes into one and move them to the websocket.impl.entities package
 - Rename classes from RegistryX to XRegistry to match websocket API

* Single line Control subtitles

* Directly call WebSocketRepository to get registries

* Add fields to registry response

 - Add fields that will be included in the registry response to the XRegistryResponse data class and change order, based on the HA core code
 - Fix nullability on AreaRegistryResponse.kt: area id could be null?

* Generalize websocket event subscriptions, fix cancelling Controls

 - Generalized the implementation for 'get updates' subscriptions on the websockets, to allow for many similar calls without repeating the same lines of codes over and over.
 - Fix cancelling websocket connections from HaControlsProviderService: takeWhile is only evaluated when there is a new message, so when there are no new messages (as expected for the registries) the subscription to the flow would remain active and the websocket connection open for longer than necessary.

* Fix websocket event to class handling

* Refresh controls when registry is updated

 - If the area or device registry is updated, reload the registry and refresh all controls to show changes.
 - If the entity registry is updated and at least one of the entities is provided, reload the registry and refresh all controls to show changes. (If not related to one of the entities provided, this could never result in a visible change.)

* Fix getting area if set in entity registry

* Replace entity updates on registry update with function

 - To limit duplicate code replace the code to update all entities when a registry is updated with a function, and also use it for the initial state
 - Fixes potential crash if entity registry state update had an old value of null

* Use constants for websocket event types

* Update device registry functions to use return try/catch pattern

* Use one Mutex for all subscribe_events messages
2021-12-26 20:55:07 -05:00
Daniel Shokouhi dca982096b
Export widget configuration activities for launcher that require it (#2072) 2021-12-24 12:34:22 -05:00
Joris Pelgröm 04e269ce52
Fix getStateChanges call always returning empty flow (#2073) 2021-12-24 12:21:32 -05:00
Daniel Shokouhi 38534bc456
Update settings screen title to match Configuration menu (#2070) 2021-12-24 07:31:27 -05:00
Daniel Shokouhi 4a3ca455a9
Catch the exception when an invalid URL is used (#2067) 2021-12-24 07:25:34 -05:00
Daniel Shokouhi 40a4bd4ec5
Show friendly name instead of entity ID when setting favorites from phone (#2060)
* Show friendly name instead of entity ID when setting favorites from phone

* Small clean up
2021-12-24 07:24:47 -05:00
dependabot[bot] 0f984e8b83
Bump kotlinx-coroutines-guava from 1.5.2 to 1.6.0 (#2071)
Bumps [kotlinx-coroutines-guava](https://github.com/Kotlin/kotlinx.coroutines) from 1.5.2 to 1.6.0.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.5.2...1.6.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-guava
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-24 07:23:09 -05:00
dependabot[bot] 60d2cc140e
Bump kotlinx-coroutines-android from 1.5.2 to 1.6.0 (#2063)
Bumps [kotlinx-coroutines-android](https://github.com/Kotlin/kotlinx.coroutines) from 1.5.2 to 1.6.0.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.5.2...1.6.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-android
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-24 07:21:36 -05:00
dependabot[bot] 0c8491627e
Bump kotlinx-coroutines-play-services from 1.5.2 to 1.6.0 (#2061)
Bumps [kotlinx-coroutines-play-services](https://github.com/Kotlin/kotlinx.coroutines) from 1.5.2 to 1.6.0.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.5.2...1.6.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-play-services
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-24 07:21:22 -05:00
dependabot[bot] 0947b35ea0
Bump kotlinx-coroutines-core from 1.5.2 to 1.6.0 (#2062)
Bumps [kotlinx-coroutines-core](https://github.com/Kotlin/kotlinx.coroutines) from 1.5.2 to 1.6.0.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.5.2...1.6.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-24 07:20:10 -05:00
dependabot[bot] adc8bb383a
Bump actions/setup-java from 2.4.0 to 2.5.0 (#2054)
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v2.4.0...v2.5.0)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-24 07:19:36 -05:00
Daniel Shokouhi cada0fae35
Breaking Change: Enforce an allow list for notification sensors to prevent battery issues (#2038) 2021-12-24 07:19:24 -05:00
Daniel Shokouhi ea1b6a716e
Remove enable all sensors toggle to reduce battery complaints (#2037) 2021-12-24 07:19:08 -05:00
dependabot[bot] fb17ae0af9
Bump android-junit5 from 1.8.0.0 to 1.8.1.0 (#2032)
Bumps [android-junit5](https://github.com/mannodermaus/android-junit5) from 1.8.0.0 to 1.8.1.0.
- [Release notes](https://github.com/mannodermaus/android-junit5/releases)
- [Commits](https://github.com/mannodermaus/android-junit5/compare/plugin-1.8.0.0...plugin-1.8.1.0)

---
updated-dependencies:
- dependency-name: de.mannodermaus.gradle.plugins:android-junit5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-24 07:18:53 -05:00
Daniel Shokouhi afa092b3c0
Bump dependencies and make required changes (#2030)
* Bump dependencies and make required changes

* Fix lint
2021-12-24 07:18:43 -05:00
zmarties b4185a7012
Typo in sensor attribute (#2029)
This is a breaking change, since any template that depends on the name
will need updating to correct to the typo corrected version.
2021-12-24 07:18:25 -05:00
Daniel Shokouhi 44eac24cb6
Change sentry exception filtering and catch some potential unhandled erros (#2066)
* Change sentry exception filtering and catch some potential unhandled errors

* Lint

* Switch error handling to websockets

* Review comment
2021-12-23 14:17:37 -05:00
Justin Bassett 6af478d772
context is optional for Entities. (#2059) 2021-12-22 16:24:16 -05:00
Daniel Shokouhi 077b4ab368
Only attempt to authenticate when connection is not null (#2058) 2021-12-22 12:36:56 -05:00