Commit graph

253 commits

Author SHA1 Message Date
Daniel Shokouhi f4c3e9f891
Use receiver exported for all sensor receiver intents (#4661)
* Use reciever exported for all intents received outside the app

* Revert change to widget and complication

* Revert null receiver battery intents
2024-09-30 18:19:54 +02:00
dependabot[bot] e30264e67e
Bump androidx.wear.compose:compose-material3 from 1.0.0-alpha15 to 1.0.0-alpha19 (#4250)
* Bump androidx.wear.compose:compose-material3

Bumps androidx.wear.compose:compose-material3 from 1.0.0-alpha15 to 1.0.0-alpha19.

---
updated-dependencies:
- dependency-name: androidx.wear.compose:compose-material3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* Make changes for building with new alpha.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Justin Bassett <Bassett.JustinT@gmail.com>
Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com>
2024-09-12 10:43:09 -07:00
Daniel Shokouhi 8270b181cf
Add signal strength and data network type sensors (#4575)
* Add signal strength and data network type sensors

* Split signal strength and data network type sensors by SIM

---------

Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com>
2024-09-11 13:49:26 -07:00
Joris Pelgröm 90139ab3b2
Open onboarding when Assist is launched when not registered (#4596)
- If Assist is opened (via the default assistant app shortcut), but the app is not yet registered, send the user to onboarding to skip having to close + open app manually. This matches the app's Wear OS behavior.
2024-09-07 18:05:16 -07:00
Joris Pelgröm e0e4293965
Add foreground service types for Android 14 target (#4561)
* Add foreground service types for Android 14 target

 - Adds information about the foreground service type as this is required when targeting Android 14 and will otherwise throw exceptions: https://developer.android.com/about/versions/14/changes/fgs-types-required

* Update automotive full manifest
2024-09-05 20:09:26 -07:00
Joris Pelgröm 241d724a0f
Add (NOT_)EXPORTED to registerReceiver for Android 14 target (#4559)
- For dynamically registered receivers, add whether or not they are exported to prevent a crash due to a behavior change when we start targeting Android 14: https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported. Exported or not depends on the list of system intents (not on list = exported to be safe): https://developer.android.com/about/versions/12/reference/broadcast-intents-31.
2024-09-05 20:09:13 -07:00
Joris Pelgröm 5b82c2001c
Breaking Change: Update heart rate sensor for Wear OS 4+ target (#4552)
* Remove heart rate sensor for Wear OS 4+

* Rework: request background permission separately

 - Requesting the background permission separately seems to work and allows the user to keep using this sensor after changing the target SDK version
2024-09-05 20:08:57 -07:00
Joris Pelgröm 7a9efaa0ef
Handle notification permission on Wear (#4551)
- Ask for notification permission after completing onboarding
 - Add a settings item to open the watch notification settings to grant permission
2024-09-05 20:08:37 -07:00
Daniel Shokouhi 50808ff98a
Rename services to actions (#4541)
* Rename services to actions

* Review comments
2024-08-03 11:24:25 +02:00
Łukasz Paczos 2281e64f81
Fixed TTS queuing mechanism and volume override resets (#4480)
fixed TTS queuing mechanism and volume override resets

A new TextToSpeechEngine abstraction has been introduced, along with a default Android TTS implementation and a TextToSpeechClient as the entry point. The client now features an independent queue, allowing for better control over the start and finish of each utterance and separating it from the engine, which focuses solely on playback. This resolves issues with interrupting utterances and volume overrides not resetting correctly when utterances are queued or force-stopped.
2024-07-12 18:32:27 +02:00
Yuri Schimke b9cacc41ab
Bump to OkHttp 5 (#4023)
* Use OkHttp 5

* Revert

* Update TextUtil.kt

* Update MessagingManager.kt

* Update HaCarAppService.kt

* Update HaCarAppService.kt
2024-07-05 16:02:25 +02:00
Joris Pelgröm 9935ad45e4
Trim Assist pipeline text messages (#4433)
- For received Assist pipeline text messages from the server, trim what is displayed in the app to avoid messages with additional empty lines as seen in the latest HA core beta
2024-06-01 23:08:50 +02:00
Daniel Shokouhi d640b9d974
Use device class enum where possible and supply possible states for those sensors (#4394)
* Use device class enum where possible and supply possible states for those sensors

* Add some missing sensors

* Review comments and suppress lint

* Add media session sensor to enum device class
2024-05-13 12:41:18 -07:00
dependabot[bot] a8f924d4b9
Bump activity-compose from 1.8.2 to 1.9.0 (#4376)
* Bump activity-compose from 1.8.2 to 1.9.0

Bumps `activity-compose` from 1.8.2 to 1.9.0.

Updates `androidx.activity:activity-compose` from 1.8.2 to 1.9.0

Updates `androidx.activity:activity-ktx` from 1.8.2 to 1.9.0

---
updated-dependencies:
- dependency-name: androidx.activity:activity-compose
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: androidx.activity:activity-ktx
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* Update nullability for overrides in app

* Update nullability for overrides in wear

---------

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>
2024-05-03 17:57:14 +02:00
Michael Vieck cda6b01589
Added Compose Previews for NFC, Onboarding & Companion Views (#4239)
* Feature/compose previews (#1)

* Compose Preview created for ChooseEntityView

* Nfc view previews added

* Added onboarding previews

* Fixed ktlint errors

* Author Test

---------

* Using phone view for preview

* Using premade preview entities

* Renamed preview logs

* Review comments

---------

Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com>
2024-04-30 17:55:05 +00:00
Daniel Shokouhi 4d9498c02b
Add some missing states for audio sensor and correct mic muted intent condition (#4350)
* Add some missing states for audio sensor

* Correct improper SDK check for mic muted intent action

* Update wear intent receivers

* Correct mic muted sensor update type
2024-04-20 15:44:04 +02:00
dependabot[bot] 15b1518a44
Bump org.jlleitschuh.gradle.ktlint from 11.6.1 to 12.1.0 (#4125)
* Bump org.jlleitschuh.gradle.ktlint from 11.6.1 to 12.1.0

Bumps org.jlleitschuh.gradle.ktlint from 11.6.1 to 12.1.0.

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

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

* Add .editorconfig

* ktlintFormat

* Fix comment in a 'value_argument_list' is only allowed when placed on a separate line

* Restore AssistShortcutView

* Fix comment in a 'value_argument_list' is only allowed when placed on a separate line

* Fix no comment expected at this location

* Fix property name should start with a lowercase letter and use camel case

* Fix parameter comments

* Fix comment in a 'value_argument_list' is only allowed when placed on a separate line, again

* Fix property name should use the screaming snake case notation when the value can not be changed

* Fix final comment in argument list

---------

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>
2024-02-06 21:02:39 -05:00
Joris Pelgröm 98f3d7abd2
Add option to update camera & template tile when 'in view' (#4185)
* Add option to update camera & template tile 'on view'

 - Use the tile enter callback to request an update to the tile once it enters the view. Considering that this callback exists it's probably safe to assume an update that is requested in this callback won't be throttled (at least it appears to work during testing).
 - Minor edit to the refresh interval picker to ensure strings that are more than one line look a bit nicer.

* on view -> in view
2024-02-02 16:44:22 -05:00
Márton Maráz c185b871fd
Make volume sensors update instantly by subscribing to a broadcast (#4162)
* Make volume sensors update instantly by subscribing to a broadcast

* Change skippableActions to a 1-to-many map and the list of all volume sensors to the corresponding Intent action key
2024-02-02 15:25:55 -05:00
Joris Pelgröm f3071e79e6
Wear Assist: show login when logged out, scroll first item into view (#4174)
- Update Assist on Wear to automatically open the login screen when logged out, instead of asking the user to close and login, to prevent text being cut off issues
 - Add another item at the top of Assist on Wear to allow the pipeline selector to be scrolled into the center of the screen (the first item cannot be scrolled into the center of the screen)
2024-01-30 18:43:49 +00:00
Joris Pelgröm 97d312bdd6
Androidx dependency updates late Jan 2024 (#4165)
- Update Wear Assist alignment to keep same appearance of an inline chevron to change the assistant
2024-01-27 17:58:40 +00:00
Joris Pelgröm ff2b0ecc79
Replace 'Refresh interval' title with icon (#4144)
- To (hopefully) finally address review failures about text being cut off on round screens replace it with an icon. Same icon as used in the previous screen so should be pretty clear.
2024-01-24 10:58:36 -05:00
Sebastian Lövdahl 5d52735e36
Support multiple Template tiles on Wear OS (#3783)
* Support multiple Template tiles on Wear OS

* Add `TemplateTileConfig` data class

* Fix migration

* `Pair` -> `TemplateTileConfig` fixes

* Fix `getAllTemplateTiles` implementation

* Initial work on companion <-> wearable device communication

* More work on phone <-> wear device communication

* Save updated template in phone app

* Get the template to render using the right method

* Fix CI complaints

* Work on Wear UI for multiple template tiles

* Update wear manifest

* Wear migration and navigation fixes

* Fix Template tile IDs in mobile app

* Make adding a new Template tile on Wear device work

* Small cleanups and TODO fixes

* Try to fix template config refresh in settings

* Fix after rebase

* Adopt blocking approach for reacting to tile events, inspired by #3974

* Use `OpenTileSettingsActivity` for template tile

* Adopt Material 3 and other UI-related changes

* Show help text in phone app if no template tiles have been added yet

* Reference the view model variable inside the function

By having the view model variable outside the block, the updated template tile
might not be propagated to the template settings view.

* Reload template tiles when opening the template tiles from settings

* Replace null key with -1 for old template tile

* Lint complaints fixes

* remove TODO

* Store error

* Scrollable list of template tiles

* Move "Configure template tile" to header

* Replace with methods with copy

* Show template as secondary text

* Fix scrolling

* Update app/src/full/java/io/homeassistant/companion/android/settings/wear/views/SettingsWearTemplateTileList.kt

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

* Remove unused field

* Move padding to "no tiles" text

* Add deep link

---------

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>
2024-01-24 10:56:39 -05:00
Daniel Shokouhi 8dd76734f8
Use horizontal padding on refresh interval per review comment (#4120) 2024-01-06 23:06:26 +01:00
Daniel Shokouhi 39b19b7fc3
Add padding to refresh interval to avoid text getting cut off (#4119) 2024-01-06 01:18:19 +00:00
Steffen Klee e0731c9c79
Add Wear OS TLS client certificate authentication (TLS CCA) support (#3924)
* Add Wear OS TLS client certificate authentication (TLS CCA) support

Wear OS does not currently allow the user to install certificates to the
system-wide KeyChain for TLS CCA support. This commit adds support for
using certificates from the app-specific Android KeyStore with UI for
setting up a certificate during the Wear OS onboarding process.
The manual step in the onboarding process is required since we cannot
transmit certificates of the Android KeyChain because they are not
extractable.

In particular, this commit adds the following changes:
* KeyStoreImpl as an additional KeyChainRepository interface
  implementation for loading and storing keys to the application's
  KeyStore. TLSHelper uses KeyStoreImpl as a fallback key manager.
* UI for selecting a certificate file with GET_CONTENT intent during
  Wear OS onboarding in OnboardingActivity if it is detected that the
  Home Assistant may require TLS CCA. The UI includes a password check
  for the PKCS12 container.
* During onboarding the app sends the raw PKCS12 data to Wear OS
  together with the container password. The connection is assumed to be
  encrypted and trusted so that no additional encryption is necessary.

* Move PKCS12 password check to lifecycle scope

* Remove redundant try-catch when loading PKCS12

* Simplify MobileAppIntegrationView layout code
2023-12-13 15:19:54 -05:00
Joseph Abbey 6b56bc579a
mobile_app_notification_cleared for wearos (#4035)
* mobile_app_notification_cleared for wearos

* Fix imports

* Remove database id extra

* Fix whitespace

* Reformatted imports and added the receiver to the manifest

* Move `handleDeleteIntent` to common
2023-12-13 14:45:46 -05:00
Joris Pelgröm 7d76bb4b51
Update tiles logged out state to prevent cut off overflow, shortcuts tile label (#3975)
Update tiles logged out state to prevent cut off overflow

 - Limit length of logged out state string to prevent text cut off and shorten strings to help with translations
 - Fix inconsistent shortcuts tile name
2023-10-28 11:15:22 -04:00
Joris Pelgröm 73c928d6e4
Update shortcut tile add/remove + destroy handling (#3974)
- Updates the shortcut tile's handling of add/remove event + destroying the service, just like the camera tile, to prevent the service scope being cancelled while the app is still storing tile added/removed
 - (this service already didn't overwrite existing tile data when onTileAddEvent was called again)
2023-10-28 11:14:55 -04:00
Joris Pelgröm 607833d4c7
Update launcher icon, Play Store feature graphic (#3960)
* Update launcher icon, Play Store feature graphic

 - Update launcher icon to better match other Android app launcher icon sizes
 - Update Play Store feature graphic to new version

* Cannot deduplicate this launcher icon on Wear

* ktlint
2023-10-20 17:47:26 -04:00
Daniel Shokouhi e10ec793d4
Show sensor state in secondary label in Wear OS sensor UI (#3959)
* Show sensor state in secondary label in Wear OS sensor UI

* Review comments

* Remove runBlocking in previews and invert label check to match phone
2023-10-20 17:46:41 -04:00
Joris Pelgröm cda25479d6
Add clear_notification support to Wear OS (#3956)
- Move the clear_notification command to common extensions and add support in the Wear OS app
2023-10-20 17:45:48 -04:00
Joris Pelgröm a94c90e5aa
Improve camera tile add/remove event handling (#3954)
- If there is already a camera tile with the ID of the tile in `onTileAddEvent` stored in the database, don't overwrite it with a new blank tile as the user configuration might be lost.
 - Run add/remove event code blocking to prevent the system immediately destroying the service and as a result cancelling the work to save tile data in the database. Without the blocking code I could semi-reliably get it to destroy the service within several milliseconds of adding/removing, often preventing the database code from running.
2023-10-20 17:45:15 -04:00
Joris Pelgröm 26c6bcd282
Fix icon button sizes (#3918)
* Fix icon button sizes

* Merge fixes
2023-10-06 18:38:09 +00:00
Joris Pelgröm 65863148fc
Update entity button with toggle styling to match M3 components (#3923)
Update entity button styling to match M3 components
2023-10-06 18:08:22 +00:00
Daniel Shokouhi 2a597602f1
Fix detail pane after material 3 migration, add additional previews (#3920) 2023-10-06 12:56:48 -04:00
Daniel Shokouhi 709ca07e8c
Shorten some settings strings (#3921)
* Shorten some settings strings

* Remove unused string
2023-10-06 16:51:32 +00:00
Joris Pelgröm f2e9541264
Fix Picker rotary input on some devices and update design (#3919) 2023-10-06 11:38:40 -04:00
Daniel Shokouhi f23a6cb046
Update Chip and ToggleChip to Button and ToggleButton except for WearToggleChip (#3917)
* Update complication config screen to m3 components

* Clean up some code so its resuable

* Review comments and bump library

* Migrate more screens

* Review comments

* Tweak some colors

* Use consistent button container color

* Remove unnecessary font color

* Tweak Button disabled color to match ToggleButton

* Update a couple more chips and a preview

* Use in app color default
2023-10-06 11:37:17 -04:00
Daniel Shokouhi d7a08d3b08
Update manual onboarding screens to prevent the button from overlapping elements (#3909)
* Update manual onboarding screen to prevent the button from overlapping elements

* Limit to 2 lines of text

* Switch to ScrollView

* Add padding for round devices

* Review comments
2023-10-05 09:58:08 -04:00
Daniel Shokouhi d3a1f318f8
Begin migrating Wear OS components to Material 3 (#3904)
* First commit of migrating Wear OS components to Material 3

* Tweak more colors, fix some variables, use switches and bold more text

* More clean up

* Fix color in default chip

* Clean up unused code
2023-10-05 09:57:41 -04:00
Márton Maráz 2641422e50
Add NFC state sensor (#3905)
* Add first draft for NFC sensor

* Rename NfcSensorManager.nfcSensor to nfcStateSensor

* Move NfcSensorManager to the common module

* Add BroadcastReceiver subscription to NfcAdapter.ACTION_ADAPTER_STATE_CHANGED in both the app and wear modules

* Remove TODO comments

* Change updateType to INTENT

* Convert simple methods to expression body

* Change mdi:nfc to mdi:nfc-variant

* Fix docs URL

* Reword NFC sensor manager according to the PR suggestions
2023-10-05 09:57:33 -04:00
Daniel Shokouhi 49cc4aa7d3
Use recommended splash screen library for Wear OS (#3908)
* Use recommended splash screen library for Wear OS

* More tweaks per recommendations

* Add splash screen to Assist

* Add splash screen for Assist

* Use mipmap instead of drawable
2023-10-02 18:24:39 -04:00
Daniel Shokouhi f9c7bceac0
Switch to Wear Device specific preview (#3906) 2023-10-02 18:23:48 -04:00
Joris Pelgröm ae3248ca4d
Update Wear more details screen to prevent cut off (#3899) 2023-09-29 22:47:36 -04:00
Daniel Shokouhi a15f7b3bc4
Add missing scroll bar to remaining screens (#3895)
* Add missing scroll bar to remaining screens

* Add Scaffold to ThemeLazyColumn

* Remove unneeded variable

* Remove nested scaffold
2023-09-29 08:29:56 -04:00
Joris Pelgröm 2f777a1379
ListHeader: fix text cut off (#3898)
ListHeader: set overflow, limit lines based on font size

 - Set overflow for ListHeader to ellipsis instead of cutting of text
 - Set the maximum number of lines for ListHeader based on the font size
 - Center text in the list header for nicer appearance in case of multiple ines
2023-09-28 17:40:39 -04:00
Joris Pelgröm 4a4cc31b97
Update icon (#3888)
* Update icon

 - Replace old icon with the new icon
 - Update app primary color to new blue tint
 - Deduplicate resources

* Update feature graphic

* Decouple app icon color from main color
2023-09-28 17:38:48 -04:00
Joris Pelgröm 43cc4d4a73
Fix rotary input after first screen & for picker (#3881)
- The recent switch to Horologist modifiers for rotary input broke after the first screen because of manual focus requesting, and the refresh interval picker in general so also switch that to a Horologist modifier.
2023-09-20 19:42:20 -04:00
Dubzer 20f87c810b
Add smooth scrolling for rotary input (#3876) 2023-09-19 15:39:25 -04:00