Commit Graph

8 Commits

Author SHA1 Message Date
Zac West
66b18db519 Reconnect if the WebView WebSocket connection is likely disconnected (#1987)
Fixes #1801 by working around the Apple bug.
Refs home-assistant/frontend#10819.
Requires core-2021.12.0b6 or newer.

## Summary
When the app has been in the background for a while without executing, reset the WebSocket connection in the WebView when execution begins again.

Also implements the new `theme-update` external bus command since it will log as an unhandled message. This likely means we're over-updating theme colors, but that is relatively cheap to do and doesn't cause harm.

## Any other notes
This works around a bug in NSURLSession's WebSocket implementation -- which WKWebView moved to in iOS 15 -- where it cannot reliably detect network connectivity failures due to extended backgrounding. Eventually it'll get a "connection reset by peer" or other error, but in the meantime it reports itself as still connected, thus leaving our WebView thinking it's connected but anything sent isn't sent and nothing is received.
2021-12-10 07:52:56 +00:00
Zac West
cea0b16936 Update dependencies (#1883)
- Updates several dependencies
- Removes Lokalise -- if we can't do it on Catalyst, it doesn't feel worth it to do it elsewhere
- Migrates the NotificationTestCases from a Podspec that keeps having issues to a fastlane script which copies in the latest ones
2021-10-16 15:19:41 -07:00
Zac West
a2491d632d Minor fixes for open page widget (#1867)
## Summary
- Fixes e.g. HACS (which is `hacs:hacs`) icons showing the A/B icon. We now fall back to the outline cog.
- Hide panels without the "show in sidebar" option. We get them in the response, but e.g. the title is incorrect.
- Changes sort order in the automatic version to more closely align with the frontend.
- Fixes a case where chosen panels in the past would fail to be updated due to being at the tail end of the array in the API response, due to truncating to widget size _before_ updating.

## Screenshots
![image](https://user-images.githubusercontent.com/74188/135203919-d2951c9a-0bfe-4eb4-8285-a74f9c546882.png)
2021-09-29 04:49:43 +00:00
Zac West
4992c97b49 "Open page" widget (#1863)
## Summary
Adds to Shortcuts and Widgets the ability to open a particular page/panel in Lovelace.

## Screenshots
| State | 1 | 2 |
| -- | -- | -- |
| Empty | ![Simulator Screen Shot - iPad Pro (12 9-inch) (5th generation) - 2021-09-27 at 22 26 11](https://user-images.githubusercontent.com/74188/135033260-a54ac04e-e2dd-4da7-a497-b04d5297db8b.png) | ![Simulator Screen Shot - iPad Pro (12 9-inch) (5th generation) - 2021-09-27 at 22 26 57](https://user-images.githubusercontent.com/74188/135033274-d7dee9da-48f6-4219-8e47-c128746e26dc.png) |
| Contents | ![Simulator Screen Shot - iPad Pro (12 9-inch) (5th generation) - 2021-09-27 at 22 53 26](https://user-images.githubusercontent.com/74188/135033294-52953ad1-c73c-49ea-bc7b-919ce5c35068.png) | ![Simulator Screen Shot - iPad Pro (12 9-inch) (5th generation) - 2021-09-27 at 22 53 33](https://user-images.githubusercontent.com/74188/135033305-2d6c2e93-9ef0-485c-a533-e6ee34e17bfa.png) |
| Shortcuts | ![Simulator Screen Shot - iPad Pro (12 9-inch) (5th generation) - 2021-09-27 at 23 17 58](https://user-images.githubusercontent.com/74188/135033520-d5a848ca-c4f5-41aa-bba8-a27b9c80489a.png) | ![Simulator Screen Shot - iPad Pro (12 9-inch) (5th generation) - 2021-09-27 at 23 18 06](https://user-images.githubusercontent.com/74188/135033531-a2102fdc-c834-4994-bc4d-c97d7af93342.png) |

## Any other notes
A good starting point for widgets which need cached information. This one is simple: 1 request that is a small JSON payload that needs to be saved. This can start to get more complex later.

- Adds an on-disk cache backed by Codable, which we use to cache panels in the widget (for data) and in the app (to see if we need to reload the widget).
- Fixes some issues and crashes with opening the action of a widget multiple times in a row.
- Adds support for grabbing frontend localizations from Lokalise and uses them for panel localization.
2021-09-27 23:24:06 -07:00
Zac West
45ed8c5fb4 Update look and feel of settings (#1578)
## Summary
Updates the root of settings to have a few less options, use the new iOS 13+ 'inset grouped' style look with icons.

## Screenshots
![Image](https://user-images.githubusercontent.com/74188/114317710-3d6dc580-9abe-11eb-9dc1-264403eeaa9b.png)
![Image 2](https://user-images.githubusercontent.com/74188/114317706-3b0b6b80-9abe-11eb-8e56-8593ea859461.png)
<img width="350" alt="Screen Shot 2021-04-11 at 12 07 01" src="https://user-images.githubusercontent.com/74188/114317762-7d34ad00-9abe-11eb-8373-32c1da77df8d.png"><img width="350" alt="Screen Shot 2021-04-11 at 12 06 54" src="https://user-images.githubusercontent.com/74188/114317765-80c83400-9abe-11eb-8d9d-b60fd1f0d224.png">
<img width="350" alt="Screen Shot 2021-04-11 at 12 07 14" src="https://user-images.githubusercontent.com/74188/114317770-858ce800-9abe-11eb-82e5-8c7eb862dabb.png"><img width="350" alt="Screen Shot 2021-04-11 at 12 07 09" src="https://user-images.githubusercontent.com/74188/114317773-8756ab80-9abe-11eb-84d1-274216c550c7.png">

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
- Moves a few things into 'Debugging' like resetting the app. Duplicates the entry point into location history (still in Location) since it's relevant there too.
- Removes the local 'AuthenticatedUser' cache (retrieved via WebView's WebSocket) in favor of the HAKit representation.
- Adds a debug-only "Add Server" button to the server list, which currently crashes when tapped.
2021-04-11 12:39:38 -07:00
Zac West
640cca884b Add SwiftFormat to project (#1463)
Adds new fastlane lanes:
- `fastlane lint` which checks the linters
- `fastlane autocorrect` which applies the linters which can autocorrect (Rubocop, SwiftFormat)

Adds a build step to the Codegen abstract target which runs SwiftFormat in lint mode, pointing out what it's going to change when run.

Applies SwiftFormat to nearly all code -- exempts a few externally-sourced files and generated code.
2021-02-05 22:06:25 -08:00
Zac West
293a149ba2 Add admin-only filtering for server-based alerts (#1401)
Fixes #1391.

## Summary
Adds optional flag `admin_only` to the alert definition. Doesn't show them when it's set and the current user isn't an admin.

## Link to pull request in Documentation repository
n/a
2021-01-22 22:32:58 -08:00
Zac West
4d9a530637 Reorganize files in repo, pull out build settings from pbxproj (#1140)
This is somewhat in prep of being able to make the project file generated, but also just organizes things into more concrete directory structures.

This pulls out _all_ of the build settings from the root level, and most from the target level, into xcconfigs.

The new directory structure looks like:

- Sources
  - App
    - (everything from HomeAssistant/)
  - WatchApp
  - Shared
  - MacBridge
  - Extensions
    - Intents
    - NotificationContent
    - NotificationService
    - Share
    - Today
    - Watch
    - Widgets
- Tests
  - App
  - UI
  - Shared

Somewhat intentionally, the file structure under these is not yet standardized/organized.

The project targets are now:

- App
- WatchApp
- Shared-iOS
- Shared-watchOS
- MacBridge
- Tests-App
- Tests-UI
- Tests-Shared
- Extension-Intents
- Extension-NotificationContent
- Extension-NotificationService
- Extension-Share
- Extension-Today
- Extension-Widget
- WatchExtension-Watch

This does not yet clean up resources vs. sources, nor does it handle some of the "it's in Sources/App but it's part of Shared" crossover directory issues.
2020-10-03 00:15:04 -07:00