* 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
* 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
* 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
- 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
- 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
* 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
* Add fan speed detail panel to Wear OS
- Added a fan speed slider for entities that support setting the fan speed
- Adjust light brightness string to include percentage symbol
* Rename extension function
* Add extensions to Entity for domain, lights features
- Add extension property for domain
- Add extension functions for lights: support for setting brightness and color temperature
* Use domain extension property in more places
* Add details panel with light brightness/colortemp control
* Update InlineSlider icons
* Process review comments
* Update toggle placement and string formatting
* Fix last strings and use representative color for Color temperature bar
* Websocket: make connected Job Deferred to get errors
- Switch the job used for monitoring whether a connection has been established to use Deferred, which will allow us to get the exception that caused the job to be cancelled (and also makes the code a little easier)
* Websocket: add variable for state
- Add a variable to the websocket repository to monitor the state of the connection. This will allow the app to respond to handled exceptions.
* More Websocket race condition fixes
- If multiple outgoing messages are pending before the connection is opened, if we receive an invalid auth message or onFailure callback this will be processed last. The connected job is still 'completed', so it shouldn't return true but return if it was successful. This will ensure that any messages after the first one that triggered the failure, will be ignored until the job is reset.
- Set the connection state to authenticating before sending the message, to make sure that we don't accidentally override a very quick response
* Handle error states in HomeView
- Add a state for the loading progress to the view model in order to be able to update the home view with errors if necessary
- If loading the main data failed because of authentication, reset the session like in the phone app and send the user back to onboarding
- Fix the app getting stuck on a loading screen, even if everything loaded correctly, if there are no supported entity domains in the response
* Allow toggling fans on Wear OS
* Allow toggling covers on Wear OS
* Update Wear phone settings to read supported domains
- Updates the Wear settings in the phone app to read from the app which domains are supported, and use this for filtering the list
- Add strings for cover and fan domains
* Fix shortcuts tile cover icon
* Add 'Sign in on phone' button to Wear OS login
- Detects a compatible app and shows a button to sign in on your phone instead, which is a lot easier than typing everything on the watch
* Include exception for phone sign in in log
* 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
* 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
* 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)
* 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
* Initial data flowing.
* Functional login from phone.
* Cleanup data transfer between devices.
* Fix minimal build.
* Address review comments.
* Defaults to actual device when logging in now.
Location hidden when logging into wear device.
* Allow favorite entities to be dragged and dropped for reordering
* Switch favorites to store in DB, fix reordering
* UI updates to reflect draggable items
* Send a json array instead of just a string, add lock domain to settings
* Only add favorites if we have them from the phone
* Remove missing entities, fix initial duplicate load
* Remove redundant work manager bump from phone
* Fix flow of favorites and remaining issues
* Build fixes
* Switch back checked variable
* First color and padding updates
* Add matrial theme
* Remove `setChipDefaults` and ktlint
* Further updates to colors and paddings
* Larger space with unicode "em space"
* Move logout button to settings and adjust padding again
* Update MainView and move entity domain lists to MainViewModel
* Animated TimeText
* Fix merge issues
* Process review comment and hide empty domains in all entities view
* Put in quick fix for showing lock state in ToggleChip
* Add non-functional example of favorites tile
* Load real scene entities into the Tile
* Make the tile buttons actionable
* Add icons of the entities
* Add tile preview image
* Also support fewer than 7 entities
* Cleanup and pass ktlint formatting
* Add support for lock domain
* Pass along state to HomePresenter
* Add lock to toggleDomains
* Revert "Merge branch 'home-assistant-master' into wear-os-add-lock"
This reverts commit b446006c00, reversing
changes made to a65b4e03e8.
* Move database to common module
* Fix lint
* Better kapt error reporting
* Alias common module's resources into app
* Move base sensor receiver & worker to common module
* Add sensor receiver & worker to wear module
* Schedule sensors Worker on app start up
* Export the SensorReceiver in the wear manifest
* Upgrade base and wear sensors Receivers and Workers to Hilt + hoist updateSensors to sensors Receiver base + introduce base location manager + fix minimal sensor stubs
* Re-add important battery sensor info
* Remove unused imports
* Listen for battery updates in wear app
* Listen for screen updates in wear app
* Fix ktlint
* Add sensors to wear OS on home screen
* Stop listening to screens and power save mode
The sensor isn't added yet
* Remove commented code due to absent sensors... for now. Mwahahaha!
* Remove unused import
* Begin work on editing favorites from the phone
* Get list of entities and show alongside favorites
* Fix minimal build
* Fix minimal build again
* Another fix attempt
* Lint
* Send and save favorites from phone to wear
* Add TopAppBar, make row clickable, minor clean up
* Add landing view, navigation and major cleanup
* Add some previews, fix missing entities, more refactoring
* Remove unused method
* Remove TODOs
* Switch to hilt
* Review comments: Fix favorite deselection, update favorits in onResume
* Review comment: remove unused code
* Review comments
* More review comments
* Correct spelling
* Apply code review to PhoneSettingListener
* Remove unneeded thread calls
* Add non-functional example of favorites tile
* Load real scene entities into the Tile
* Make the tile buttons actionable
* Add icons of the entities
* Add tile preview image
* Also support fewer than 7 entities
* Cleanup and pass ktlint formatting
* Add settings page for tile shortcuts
* Use new settings in Tile
* Make the tile update when the settings are changed
* Support all types of entities in TileActionActivity
* Rename tile and process comments
* ktlint
* Update layout of settings a bit
* Use a string resource like a normal person
* Remove remaining SetTitle instances
* Process review comments and add data class to store entity strings
* Process review comments
* tiny ktlint fix
* Fix broken previews
* Fix white lines after merge
* Move tile refresh to compose function.
* Fix crash when missing friendly name or icon.
* ktlint...
Co-authored-by: Justin Bassett <bassett.justint@gmail.com>
* Better state hoisting.
* Broke down compose items and removed dependant state.
* Functional minus favorites....
* Favorites working, not my best solution.
* Breaking more stuff down.
* ktlint.
* Initial setup of WebSockets!
* Got some good sets of table tennis going.
* Move to a more kotlin friendly way to lock.
* Functional get config call.
* Remove testing function.
* Linting.
* Migrate get config calls to websockets!
* Working retries.
* Get services now as websocket request.
* Remove unused service call via api.
* Fix issue with widget not prompting the correct items.
* Migrate to websocket get states.
* ktlint.
* Review Comments.
* Add settings and favorites for wear
* Use proper variable for navigation
* Refactoring to remove clutter from HomeActivity
* Always start set favorites at the top
* Review comments
* Correct merge mistake
* Add rotary input on set favorites screen
* Convert wear home activity to compose
* Bump compose libraries and make UI consistent
* UI fixes based on review comments
* Use chip overflow and max lines instead of take
* Bump activity compose dependency in wear
* Clean up old files
* Remove more unused files
* Pass entities into composable and use rememberSaveable for the lists
* Move getEntities to ViewModel for recomposition
* Restore onViewReady changes
* Add a loading screen while waiting on viewmodel
* Add Wear OS Settings section
* Fix minimal build
* Fix PR build and hide category by default
* Mention Wear OS app is only offered as a beta in case user is unable to install
* Review comments
* Initial proof-of-concept: sharing Session over data layer
* Add initial onboarding and login flow
In onboarding, the home assistant urls are received from connected devices. If the user clicks on it, the authentication flow starts.
The user can alter the login details and proceed to login.
The authentication uses the "auth/login_flow" api, instead of the normal authentication api, since there is no support for webview on wear os.
* Clean up wear and app communication
Clean up
* Add proof of authentication on home. And add logout button on home
* Update onboarding list
* Add loading views and error messages
* Move startup logic to HomeActivity to hopefully save some resources
* Add manual setup option and improve UI
* Cleanup
* Passing ktLintCheck
* Passing ktLintCheck after rebase
* Fix building after build.gradle changes during rebase
* Process review comments
Remove multiple product flavors
Remove unnecessary log
Replace margin with additional header
* Update to use latest Android Gradle Plugin.
This includes updating to use Java 11.
Also bump a test dep.
* Bump Dagger
* Naming of task for JDK Setup.
* Disable test.... scopes stink for testing.
* ktlint.