Commit graph

122 commits

Author SHA1 Message Date
Daniel Shokouhi afa8a83496
Add missing boot completed permission for Wear OS (#3042) 2022-11-09 16:15:26 -05:00
Daniel Shokouhi 57b3b771b4
Track time between hardware sensor updates to restart the listener as needed (#3026)
* Check if listener got stuck for heart rate sensor and restart if needed

* Apply reset listener logic to other hardware sensors

* Review comments
2022-11-09 16:14:49 -05:00
Daniel Shokouhi affc60178e
Add daily floors sensor for Wear OS3 devices (#3005)
* Add daily floors sensor for Wear OS3 devices

* Do a compatibility check for sensor availability in health services

* Print more logs and attempt to send latest data, update more getAvailableSensor methods

* Process review comments

* Process more review comments, use actual time in millis

* Clear out available sensors when updating with new list

* Log the capabilities in case we need to troubleshoot later

* Review comment

* Missed one additional review comment

* Return immediately instead of storing a list
2022-11-09 16:12:13 -05:00
Mads Sørensen e01246ae28
Add caching of favorites in Wear OS, resulting in prettier loading (#2982)
* Add caching of favorites, results in prettier loading

* Update wear/src/main/java/io/homeassistant/companion/android/home/MainViewModel.kt

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>

* Implement a lot suggestions from @jpelgrom
Revert previous changes to database and implement properly

* Apply suggestions from code review

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>

* Implement suggestions from @jpelgrom

* Remove null assertions from icon function

* Update wear/src/main/java/io/homeassistant/companion/android/home/views/MainView.kt

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>

* Fallback to entity ID if friendly_name is missing when creating cache,
Remove wrapper function to delete cached items

* Remove "clear cache" button

* Implement changes by @jpelgrom

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>
2022-11-09 16:06:38 -05:00
Daniel Shokouhi c89184bf31
Bump and switch to compose BOM dependency (#3028)
* Bump and switch to compose BOM dependency

* Bump kotlin and compose extensions
2022-11-03 12:31:35 -04:00
Jorden 1b1c2bb672
Change DocsLink in Wear OS Sensors (#3017) 2022-11-03 12:27:38 -04:00
Daniel Shokouhi 7f5dd17c87
Add a heart rate sensor to Wear OS (#3008) 2022-10-28 13:34:05 -04:00
StopMotionCuber 11f2006924
Set focus for onboarding activity to support rotary input (#3009) 2022-10-28 13:21:17 -04:00
Tiger Oakes 3f9b01affa
Remove unused setters (#3002) 2022-10-28 13:20:29 -04:00
Jorden 209497e0a2
Fix global vars in bedtime and theater mode (#3001) 2022-10-26 11:32:53 -04:00
Daniel Shokouhi 2a56db4a17
Add user activity sensor from health services for Wear OS (#2995)
* Add user activity sensor from health services for Wear OS

* Only add health services if device supports it

* Move library initialization to after isEnabled check

* Review comments
2022-10-25 21:31:28 +00:00
Jorden 1faf03a490
Add Wet Mode Sensor (#2994)
* Add Wet Mode Sensor

* Add Wet Mode Sensor

* Change Description

* Fix spelling

* Fix Sloppy mistakes
2022-10-25 17:12:28 -04:00
Daniel Shokouhi 6da455f1be
Add previews to Wear OS compose and sort sensor by name (#2984)
* Add composable previews for a few missing functions

* Sort sensors by name

* Review comment

* Specify the device for Wear OS previews
2022-10-25 17:08:06 -04:00
Tiger Oakes 993012f9dd
Convert Play tasks to coroutines (#2962)
* Convert tasks to coroutines

* Fix lint issues

* fullImplementation
2022-10-25 17:07:19 -04:00
Daniel Shokouhi c95725f767
Add more Wear OS sensors (#2981)
* Add more Wear OS sensors

* Update description for how sensors update, also update the type
2022-10-21 18:19:41 +00:00
dependabot[bot] bd26435eb8
Bump community-material-typeface from 6.4.95.0-kotlin to 7.0.96.0-kotlin (#2944)
* Bump community-material-typeface from 6.4.95.0-kotlin to 7.0.96.0-kotlin

Bumps [community-material-typeface](https://github.com/mikepenz/Android-Iconics) from 6.4.95.0-kotlin to 7.0.96.0-kotlin.
- [Release notes](https://github.com/mikepenz/Android-Iconics/releases)
- [Changelog](https://github.com/mikepenz/Android-Iconics/blob/develop/gradle-release.gradle)
- [Commits](https://github.com/mikepenz/Android-Iconics/commits)

---
updated-dependencies:
- dependency-name: com.mikepenz:community-material-typeface
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* Rename text-to-speech to microphone-message

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com>
Co-authored-by: Justin Bassett <bassett.justint@gmail.com>
2022-10-21 17:57:15 +00:00
Daniel Shokouhi e8fe823312
Add On Body sensor for Wear OS (#2961)
* Add On Body sensor for Wear OS

* Remove unnecessary requirement
2022-10-21 13:47:20 -04:00
Joris Pelgröm e287321c53
Show settings chip while loading Wear app (#2968)
* Show settings chip while loading Wear app

* Disable favorite editing while loading
2022-10-19 14:54:09 -04:00
Daniel Shokouhi 7c792c4d4b
Add permissions requests to wear OS sensors and add network sensors (#2956)
* Add permissions requests to wear OS sensors

* Add intents for network sensors on wear

* Separate background/foreground location permission requests

* Prompt for background permissions after foreground was successful

* Only set sensor to enabled if all permissions are grantted

* Review comments

* Process more review comments

* Remove unnecessary variable update
2022-10-19 14:48:35 -04:00
Joris Pelgröm 4a9dd8ba04
Android 13 notification changes + target (#2682)
* Request notification permission during onboarding

 - When using Android 13 or the minimal version, add a screen to onboarding to request to enable notifications on the device. This screen is based on iOS onboarding. When tapping Continue, on Android 13 this requests the system permission and/or on the minimal version this changes the websocket setting.
 - Compile with and target SDK 33 (targeting required to be able to request notification system permission on demand)

* Add notification settings link in settings when off

 - Show a new setting in settings for the user to enable notifications for the Home Assistant app, either because the permission was denied (Android 13) or the user manually turned off all notifications (Android 8-12).
 - This new setting replaces the notification channels setting when everything is off; in this case there is no point managing individual channels. If at least one channel is on, the existing notification channels setting is shown instead.

* Compose tweaks

 - Remove redundant content description for icon
 - Change to a simpler scroll modifier

* Fix skipping notifications on minimal version

 - Ensure that the value is actually saved to the database

* Post Bluetooth on/off commands as if invalid

 - When using Android 13, post notification commands to control Bluetooth on/off as a normal notification as if they were invalid, as the function has been deprecated for the app

* Remove type that can be inferred
2022-10-19 14:43:15 -04:00
Joris Pelgröm abf0220430
Update Gradle to 7.5.1, Android Gradle plugin to 7.3.0 (#2934)
- Update Gradle to latest version (7.5.1)
 - Update Android Gradle plugin to latest version (7.3.0)
 - Move package property out of manifest into gradle build files namespace as recommended
2022-10-01 16:14:45 -04:00
Joris Pelgröm 0222d6b673
Bump Google dependencies (#2910) 2022-09-24 16:04:58 -04:00
Daniel Shokouhi 7ab914a8bb
Mark Wear OS app as non-standalone since we use phone for sign in now (#2900) 2022-09-21 00:40:48 +00:00
Joris Pelgröm 69beab3a2a
Don't collapse lists by default if there's only one list (#2861)
Don't collapse lists by default if there's only one key

 - If there is only one key, the app shouldn't collapse it by default as the app may not use a collapsible header in that case
2022-09-10 15:17:10 -04:00
Joris Pelgröm a711c659a4
Update Wear onboarding to always use phone for sign in (#2838)
* Always do Wear onboarding on phone

 - Switch the Wear onboarding to always use the sign in flow on the paired phone, instead of offering the option to sign in completely on the watch.
 - When opening the companion app using the Wear app, immediately link the user to the list of instances or sign in screen.
 - Use standard OAuth flow for devices without companion app installed.
 - Fix type casting of location preference in Wear onboarding result.

* Fix ListenableFuture await import
2022-09-05 10:25:13 -04:00
Joris Pelgröm 3908a07c1f
Prevent crashes on Wear when offline / server no longer available (#2825)
- Catch exceptions thrown when executing calls to change an entity state instead of crashing the app
 - When revoking a session fails continue with logout as the server might no longer be available and the user otherwise might be 'locked in' with no way to change the server
2022-08-29 20:53:52 -04:00
Wouter van der Wal 0148c65284
Calculate fan speed step count (#2818)
* Calculate fan speed step count

* Fix linting issues

* Fixed wrong function name in log text

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>
2022-08-29 20:27:02 -04:00
leroyboerefijn d00c823651
Faster entity selection Wear OS (#2804)
* Always collapse headers and add favorites section

* Remove unneeded entity update subscription

* Process comments

* Use shorthand for favorites loop in MainView
2022-08-29 20:24:35 -04:00
Joris Pelgröm bddb3a62dd
Don't include session in backup/transfer (#2747)
- The session data is unique to the device and shouldn't be included in a backup or transfer
 - Add Android 12+ backup rules for Wear OS
2022-08-03 18:02:31 -04:00
Joris Pelgröm 9fc98e464e
Remove error message on null template (#2735)
* Remove error message on null template

 - Null is a valid value for a template so the app should reflect that instead of suggesting there is an error, which may cause users to start looking in the wrong place.

* Log.e instead of Log.i
2022-08-03 17:59:00 -04:00
leroyboerefijn e7a926396d
Implement html styling on the template tile (#2653)
* Implement styling on the template tyle

* Also process preview in phone settings

* Small cleanup

* Improve template null handling

* Update template rendering error

* Update help text to indicate new line and markup options

* Also support newline

* More extensive replacement for <br>
2022-07-29 17:42:17 -04:00
Joris Pelgröm 7b401abddc
Don't complete onboarding on registration error (#2646)
- Add specific error if the app encounters a HTTP 404 response during onboarding registration, because that means the mobile_app integration is missing
 - After an error, clean up the session data to make sure a new registration attempt is made
2022-06-30 21:58:24 -04:00
Joris Pelgröm aa256676c4
Show entity state on chip background (#2634)
* Show entity state on entity chip in Wear OS app

 - Shows the color and position of an entity state on the entity's chip in the Wear OS app by using a custom background class that accepts more than a single Color

* Use horizontal instead of diagonal gradients

 - The default BrushPainter actually isn't the correct one, the ToggleChip class uses its own but that is marked as internal and we cannot override the default BrushPainter so another copied class it is

* RTL entity position support

 - When using an RTL language, the entity chip should fill in the position value from the right side

* Support cover position

 - Show cover position as entity chip's background
 - Adjust background color code to also work when a chip isn't checked for covers that are currently closing

* Cleanup EntityUi

* Cleanup duplicate code in device controls

* Naming conventions

 - Should've used a lowercase letter to start
 - Fix class

* Fix build

 - Updates because ToggleChipColors has changed
 - Add workaround for implementing Compose interface because kotlin-gradle-plugin is linked to stable Compose and we cannot update yet

* Update gradient values to match rc02

 - Wear Compose 1.0.0-rc02 changed the default values for the gradients in ToggleChips, so update the values used when using a custom background to match
2022-06-30 21:56:38 -04:00
Joris Pelgröm 71b1fe1a00
Speed up device controls/Wear OS loading by doing network async (#2636)
* Speed up loading device controls by running network async

 - Speed up loading the device controls menu and initial controls by launching all requests in an async block, which allows the server to respond out of order
 - For individual controls, only start listening for changes once we have provided initial controls

* Speed up Wear OS cold boot by running network async

 - Speed up a cold boot of the Wear OS app by launching all network requests in an async block, which allows the server to respond out of order
2022-06-26 14:19:24 -04:00
leroyboerefijn b261fe1fdf
Bump wear compose to 1.0.0-rc02 (#2633)
* Bump compose, make it build and update loading screen

* Fix toggle icons

* Update refresh interval picker layout

* Remove potential empty item in MainView to improve content alignment in window

* Fix rotary scroll

* Fix toggle icon in DetailsPanelView

* Stop using hardcoded strings...

* Bump to rc02

* Smoother rotary scrolling

* Revert "Smoother rotary scrolling"

This reverts commit e13738983d.

* Only show loading screen in one place to make sure we always see the same ui
2022-06-26 14:16:06 -04:00
leroyboerefijn 50d387a726
Entity state complication (#2574)
* Add entity state complication with hardcoded entity id

* Add config activity and save entity id in DB

* Update complications when entity state changes

* Allow all entity types for complication

* Update config layout

* remove unused file

* Upload database json

* Process review comments!

* Fix little bug

* Icon background and error catching

* Add automatic refresh and fix missed Dao inject

* Add icons for standard domains

91cd584b4b/src/common/const.ts (L66)

* Cleanup and further icon updates
2022-06-20 20:24:37 -04:00
Tiger Oakes f4375e4b72
Add dagger module for daos (#2541)
* Add dagger module for daos

* Update classes in common to inject daos

* Update app view models to use inject

* Use inject with widgets

* Update app activities and fragments to use inject

* Clean up imports

* Make TileExtensions use coroutines
2022-05-30 14:04:26 -04:00
Joris Pelgröm c98b291d30
Sync sensor enabled state with core 2022.6+ (#2547)
* Sync sensor enabled state from app to core

 - Change sensor 'registered' to indicate not registered, registered as disabled or registered as enabled
 - When a sensor is disabled, set it's status as such on core 2022.6 servers
 - In the sensor registration, use the basic sensor details in case there is no info in the database that can be used

* Clean up version check

 - Now that there is a standard function to get the version, re-use it

* Improve which sensors are synced to core

 - Update database migration to reset registration state on db upgrade to make sure the information is correct for all sensors
 - Only sync sensors that are actually available on the device
 - Fix registering all sensors on core <2022.6 on app/core version change
 - Fix unnecessary sensor updates due to location sensors which are never registered always triggering update on core >=2022.6

* Sync sensor enabled state from core to app

  - After pushing app enabled changes to core, if on core 2022.6 check if the enabled state for any of the sensors is different from what is registered in the app and try to update the sensors. This is done by reading the entire config, because otherwise we wouldn't know about sensors that have been enabled and the app already updates all sensors at the same time so no need for tracking individual updates in the sensor update response.
  - Restore getting config using webhooks, because only the webhook config contains information about entity enabled state
  - Add support for opening a specific sensor's settings page, used for the notification when trying to enable a sensor that requires granting (additional) permissions
2022-05-29 11:22:52 -04:00
Tiger Oakes c532b74a94
Update compose items loops to use keys (#2544) 2022-05-29 10:32:20 -04:00
Joris Pelgröm a06f96fd4d
Provide Compose preview for Play Store listing screens (#2542)
* Provide Compose preview for Play Store listing screens

* Update previews for onboarding

 - Set theme correctly and show system UI
 - Add variant for dark mode

* Update Wear OS listing image

* Remove specific icon, we can use domain default
2022-05-23 17:13:31 -04:00
Joris Pelgröm f81989f78e
Hide hidden entities on Wear home screen (#2509) 2022-05-08 13:15:26 -04:00
Joris Pelgröm 1f95e6af87
Allow refreshing Wear template tile by tapping anywhere (#2508)
- The touch target for the refresh button is really small and there aren't any other conflicting actions, so allow tapping anywhere to refresh the content
2022-05-08 13:13:28 -04:00
Joris Pelgröm fc8e961ef1
Add haptic + toast feedback to Wear OS details screen (#2455) 2022-04-23 07:16:21 -04:00
Tiger Oakes 3309c59bfd
Move SensorDao operations to Transactions (#2447)
* Add setSensorsEnabled helper

* Update SensorDetailViewModel

* Update sensormanager
2022-04-23 07:10:51 -04:00
Tiger Oakes 6c64b31f7e
Use collectAsState for SensorDao.getAllFlow (#2423) 2022-04-06 17:52:21 -04:00
Tiger Oakes dbb1e8bf5d
Use suspend and transactions for Favorites dao (#2398) 2022-03-25 12:56:18 -04:00
Joris Pelgröm 81831a978e
Fix Wear default domain icon on shortcut tile (#2404)
- Fixes the default domain icon on shortcut tiles not working because of a missing ".", used an extension function to prevent this problem in the future
2022-03-25 12:51:58 -04:00
Joris Pelgröm 965ee61b11
Don't crash on sensor update on on/off/setting change (#2391)
* Don't crash on sensor update on on/off/setting change

* Update logging message, also for Wear OS
2022-03-22 20:17:17 -04:00
Joris Pelgröm b26928bbea
Update Kotlin to 1.6 and Compose to 1.1 (#2372)
* Update Kotlin to 1.6 and Compose to 1.1

 - Remove @ExperimantalComposeUiApi, @ExperimentalWearMaterialApi annotations (because the functions aren't experimental, we are just using an experimental API) and replace with an opt-in declaration at the 'lowest level' usage
 - Websocket: ProducerScope is no longer experimental so the annotation can be completely removed
 - Wear: the animation APIs that are used for the time text are no longer experimental so the annotation can be completely removed

* Update for Compose sensor settings merge
2022-03-15 10:15:14 -04:00
leroyboerefijn 261ae31fed
Add haptic feedback to templite tile refresh (#2349) 2022-03-07 21:59:17 -05:00