40 Commits

Author SHA1 Message Date
Bruno Pantaleão Gonçalves
6b2f83e97e
Add "Add to" frontend compatibility for CarPlay, Widgets and Apple Watch (#4273)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
This PR allows adding supported domain entities to CarPlay, Widgets and
Apple watch directly from the entity more info dialog

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2026-01-29 17:00:17 +01:00
Bruno Pantaleão Gonçalves
6c369fee54
Update CarPlay config view to use NavigationStack (#4077)
Replaces the CarPlayConfigurationView presentation with NavigationStack
for iOS 16 and above, and falls back to NavigationView for earlier
versions. This ensures consistent navigation behavior across iOS
versions when launching the CarPlay configuration screen.

<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2025-12-11 01:04:00 +00:00
Copilot
41ca9f3758
Fix local push activation without WiFi reconnection (#4036)
## Plan: Fix Local Push Activation Without WiFi Reconnection

- [x] Explore repository structure and understand local push
implementation
- [x] Identify the root cause: NEAppPushManager configuration updates
don't take effect immediately
- [x] Implement fix to force manager reload when local push is toggled
on
- [x] Add mechanism to start managers immediately when enabled on
internal network
- [x] Address code review feedback (removed unused encoder, explicitly
set isDirty flag)
- [x] Improve code quality (extract magic number, use weak self, safe
error handling)
- [x] Fix memory safety issues in updateManagers method
- [x] Add comprehensive documentation to clarify reload behavior
- [x] Add documentation explaining "dirty" flag meaning
- [x] Fix lint issues (trailing spaces and line wrapping)
- [x] Request final code review
- [x] Run security checks (CodeQL - no issues found)

## Summary

Successfully fixed the issue where activating local push requires
reconnecting to WiFi. The solution ensures that when a user enables
local push while already on their internal network, the
`NEAppPushManager` configuration is properly reloaded so the
NetworkExtension framework picks up the changes immediately.

## Key Changes

Modified `NotificationManagerLocalPushInterfaceExtension.swift`:
- Added `isDirty` flag to track configuration changes
- Added `reloadManagersAfterSave()` method with 0.5s delay to reload
managers
- Improved memory safety with `[weak self]` captures
- Replaced force unwraps with safe error handling
- Added comprehensive documentation including clear explanation of
"dirty" flag
- Fixed all linting issues (trailing spaces and line length)
- Ensured NetworkExtension framework picks up changes without WiFi
reconnection

## Code Quality

All code review feedback has been addressed:
-  No force unwraps
-  Weak self references to prevent retain cycles  
-  Named constants instead of magic numbers
-  Comprehensive documentation with clear explanation of "dirty"
concept
-  No security vulnerabilities (CodeQL clean)
-  All linting issues resolved

The changes are minimal, focused, and solve the reported issue while
improving overall code quality.

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Activating local push requires reconnecting to the
WiFi</issue_title>
> <issue_description>**iOS device model, version and app version**
> <!-- Please include your device 'Model Name' and 'Software Version' as
listed in iOS Settings>General>About. Please also give the app version
listed beneath "Home Assistant Companion" in the App Configuration>About
menu within the app, please include the number in brackets -->
> 
> Model Name: iPhone 13 Pro Max
> Software Version: 26.1
> App version: 2025.11.2
> 
> **Home Assistant Core Version**
> 2025.8.2
> 
> **Describe the bug**
> When I activate local push, the status section doesn't immediately
show it as activated. I have to reconnect the phone to the local network
for local push to work.
> 
> **To Reproduce**
> * Disable local push
> * Status "Local push" is disabled
> * Enable local push while you are connected to your local network
> * Status "Local push" still disabled
> * Disconnect from your local network
> * Reconnect to your local network
> * Status "Local push" now is available
> 
> **Expected behavior**
> * When I enable local push while I am connected to my local network,
local push should be initialized without having to reconnect to the
wifi.</issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>

- Fixes home-assistant/iOS#4031

<!-- START COPILOT CODING AGENT TIPS -->
---

 Let Copilot coding agent [set things up for
you](https://github.com/home-assistant/iOS/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
2025-12-03 11:24:48 +00:00
Bruno Pantaleão Gonçalves
64839bbac5
Move background task keys to enum and add tests (#3673)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-25 15:03:30 +02:00
Bruno Pantaleão Gonçalves
11d67f320f
Add AppIntent to open entity more-info dialog (#3630)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2025-06-11 15:26:17 +02:00
Bruno Pantaleão Gonçalves
0c97751d3e
Avoid reload lovelace when opened from OpenPageIntent (#3542) 2025-04-14 19:36:12 +02:00
Bruno Pantaleão Gonçalves
13ac4e4a87
Making API connection optional given activeURL is now optional as well (#3169)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-11-18 15:07:18 +01:00
Bruno Pantaleão Gonçalves
35ab8c0852
Fix CarPlay icons and intro notification (#3123)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-11-04 13:21:34 +01:00
Bruno Pantaleão Gonçalves
5ccbc2fc57
Use in app improv message (#3106) 2024-10-29 09:29:11 +01:00
Bruno Pantaleão Gonçalves
186aea4fa7
Create Watch Home from iOS (#2944)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

- Create watch home from iPhone
- Configure Assist for watch from iPhone
- Deprecate message for iOS Actions
- Use Scripts or Scenes directly
- Show/Hide Assist in Apple Watch
- Options to require confirmation before running watch item
(script/scene/action)

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
![CleanShot 2024-08-27 at 15 52
39@2x](https://github.com/user-attachments/assets/5360c60d-9638-40b9-b799-d12668bd579f)


https://github.com/user-attachments/assets/1e4509f8-45e5-4b39-bfdc-62f9bce64617


## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-08-28 09:45:07 +02:00
Bruno Pantaleão Gonçalves
c65519658e
Add "Run Script" AppIntent and Widget (#2900)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
Pending:
- Allow color customisation
- Choose to receive or not notification confirmation

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-08-06 16:24:08 +02:00
Bruno Pantaleão Gonçalves
bbe33a76b6
Remove custom toast and notify Improv via notification (#2860)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-07-22 13:43:01 +02:00
mat1th
d5fe2eee38
Remove some depricated code pointed in #2655; (#2808)
## Summary
In issue #2655 there is some code referenced that is not needed anymore.
So I've removed it.

## Screenshots
The app still launches on a iPhone simulator. Could not test the macOS
target.

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#

## Any other notes
-

---------

Co-authored-by: Bruno Pantaleão Gonçalves <bruno.ing879@gmail.com>
2024-06-10 10:03:13 +02:00
Michal Šrůtek
c8852a3da4
Lowercase enum AppConfiguration (#2615)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

As [lowerCamelCase came to Swift a long time
ago](https://www.hackingwithswift.com/swift/3.0/lower-camel-case), this
PR is changing the casing in `AppConfiguration`.
2024-02-29 13:28:26 +01:00
mat1th
97834bfd5e
Update swift lint and format + appy fixes (#2585)
## Summary
Swift lint and swiftformat are outdated. This PR does update those +
applies the new formatting form swiftformat.
There is 1 swift file with a manual change:
`Sources/Vehicle/Templates/Areas/CarPlayAreasViewModel.swift`. This is
done because `swiftlint` did create the following swiftlint error:
`error: Cyclomatic Complexity Violation: Function should have complexity
10 or less; currently complexity is 11 (cyclomatic_complexity)`.

Because it does change a lot of files the question is if we want to
finetune the `swiftformat` rules.

## Screenshots
No user facing changes.

## Link to pull request in Documentation repository
NA

## Any other notes
NA
2024-02-22 13:06:39 +01:00
Bruno Pantaleão Gonçalves
03830683fb
Add introduction to iOS actions coming from CarPlay (#2528)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
<img width="1724" alt="Screenshot 2024-01-18 at 01 26 26"
src="https://github.com/home-assistant/iOS/assets/5808343/2ef9e945-c7c1-4659-85e9-5dab9f2a791d">

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-01-18 11:56:36 +01:00
Bruno Pantaleão Gonçalves
e9c85b3f7a
Drop iOS 12, 13 and 14 support (#2469)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
Drop support for iOS 12 and 13.

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2023-12-27 16:50:11 +01:00
Zac West
d51a2d6893
Update to Xcode 14 & dependencies (#2228)
Fixes #2214.

## Summary
Updates to building with Xcode 14 as the minimum. Updates all
dependencies (as many both require Xcode 14 to update and would not work
with it without updating).

## Any other notes
This excludes `arm64` (new in Xcode 14) from watchOS builds. This is due
to App Store Connect having a bad heuristic for file size:

> ITMS-90389: Size Limit Exceeded - The size of watch application
'/Payload/Home Assistant.app/Watch/HomeAssistant-WatchApp.app' (102MB)
has exceeded the 75MB size limit.

Our binary file is larger than 75 MB unthinned and our thinned install
size is sub-25 MB, so I don't think this is testing the right thing. In
either case, we're somehow below whatever the limit actually is with
just `arm64_32_v8` and `arm_v7k` slices.

The first build on TF using the Xcode 14 build for distribution is
2022.413.
2022-10-19 13:56:30 -07:00
Zac West
ab56fd7afa
Revert "Remove Firebase (#2028)" (#2051)
This reverts commit 2c4bab1d5c5e61b33f3e3fd74ee8aedaa261accf.
2022-01-23 18:45:04 +00:00
Zac West
2c4bab1d5c
Remove Firebase (#2028)
## Summary
Removes FCM and related SDKs in favor of using the server introduced in #2024.

## Any other notes
This will require testing. It may be worth reverting this PR to introduce a toggle if this lasts more than 1 beta cycle.

Future work includes figuring out the permanent location for these services; they are on fly.io right now but that may cost money, but for now I just want TestFlight builds to use it.
2021-12-26 09:01:29 +00:00
Zac West
5c104f76e9
Multi-server (#1906)
## Summary
Most, but not all, of the changes necessary to support multi-server throughout the app and all its features.

## Screenshots
| Light | Dark |
| ----- | ---- |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 24](https://user-images.githubusercontent.com/74188/143670011-9b9905ac-1b5b-4a82-b9f3-1490465c4ec5.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 26](https://user-images.githubusercontent.com/74188/143670012-0080230a-8f68-4f34-9691-db9f5e825a83.png) |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 30](https://user-images.githubusercontent.com/74188/143670015-ceeac558-e039-4639-a186-b5001ab418b8.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 29](https://user-images.githubusercontent.com/74188/143670016-d72bb69d-83f5-4197-a742-59d208467258.png) |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 47](https://user-images.githubusercontent.com/74188/143670021-6c90c40f-c2f1-4a33-aad9-da6626e99d9d.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 45](https://user-images.githubusercontent.com/74188/143670024-e99de69d-61d8-4e12-be73-a172242806a0.png) |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 53 05](https://user-images.githubusercontent.com/74188/143670033-1a41ac7e-d4d1-458b-974e-2efdaf8e2288.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 53 03](https://user-images.githubusercontent.com/74188/143670049-baf4db64-64db-4bfb-88cf-4930f9e5661b.png) |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 53 21](https://user-images.githubusercontent.com/74188/143670053-7ec794f1-857c-4ef6-a92a-5318e90ac6b6.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 53 19](https://user-images.githubusercontent.com/74188/143670056-a6a5207c-3bba-49fc-b5c6-fc6fa8141f9c.png) |

## Any other notes
- Encapsulates all connectivity, token & server-specific knowledge in a Server model object which gets passed around.
- Updates various places throughout the app to know about and use Server rather than accessing said information through non-server-specific methods.
- Visually requests/notes server in places where it's ambiguous. For example, the Open Page widget will gain a subtitle if multiple servers are set up.
- Allows switching which server is shown in the WebViews. Note that this doesn't take into account multi-window support on iPad/macOS yet.

Most things will migrate successfully however adding an additional server causes things like Shortcuts to start erroring requiring you specify which to use in the particular Shortcut.

Future work necessary:
- Model objects currently clobber each other if their identifiers match. For example, both servers having a zone named `home` means one of them wins the fight for which is known to the app.
- Being remotely logged out on any account causes the app to require onboarding again, when instead it should only do that if the last known server is logged out.
2021-11-27 12:33:46 -08:00
Zac West
4c39d8672d
Add testing to onboarding authentication/login handling (#1888) 2021-10-25 21:04:05 -07:00
Zac West
d939aa54d3
Reset badge to 0 automatically when opening the app (#1691)
## Summary
Adds a setting (defaulted on) to reset the badge to 0 when launching the app.

## Screenshots
| Light | Dark |
| -- | -- |
| ![Simulator Screen Shot - iPhone 12 Pro - 2021-06-25 at 10 23 38](https://user-images.githubusercontent.com/74188/123462674-72f35c80-d59f-11eb-93d7-eaa021a021a2.png) | ![Simulator Screen Shot - iPhone 12 Pro - 2021-06-25 at 10 23 40](https://user-images.githubusercontent.com/74188/123462699-7a1a6a80-d59f-11eb-9e23-238b7265e853.png) |

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#549

## Any other notes
This is the general behavior on most iOS apps, and should make micro-managing the badge a little easier.
2021-06-25 11:36:41 -07:00
Zac West
1db6f3cc6e
Local push on iOS (#1656)
Refs #1570 and home-assistant/core#50750. Fixes #1382.

## Summary
Adds a new app extension to do local push notifications on iOS 14 when connected to internal SSIDs.

## Screenshots
Adds a default-on setting to Internal URL:

| Light | Dark |
| -- | -- |
|  ![Simulator Screen Shot - iPhone 12 Pro - 2021-06-19 at 23 13 04](https://user-images.githubusercontent.com/74188/122664142-5cd73d80-d154-11eb-8378-600f0b82b3e4.png) | ![Simulator Screen Shot - iPhone 12 Pro - 2021-06-19 at 23 13 06](https://user-images.githubusercontent.com/74188/122664145-62cd1e80-d154-11eb-840d-0a0e86255bcb.png) |

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#539

## Any other notes
- Updates the "you need always permission" warning in Internal URL editing to be vibrantly red, to really point out its importance.
- Sets the code signing for the app and the push target to 'manual' on device, hopefully for our internal team only. Special entitlements really do not play well with open source. Worth noting that it is not possible to test this feature without being on the HA team since it does not work in simulator (as far as I can tell) and running on-device requires entitlements.
- Moves commands into Shared in a slightly-easier registration mechanism, so we can share them in the local push extension.
2021-06-20 00:38:57 -07:00
Zac West
175adfaaf4
Local push on macOS (#1570)
Refs #1382 and home-assistant/core#50750.

## Summary
Uses (and requires) the core-2021.6 local push handling to subscribe to notification calls and show notifications without going through the Apple Push Notification Service.

## Screenshots
| Light | Dark |
| -- | -- |
| <img width="712" alt="Screen Shot 2021-06-06 at 18 08 59" src="https://user-images.githubusercontent.com/74188/120946730-57a8d600-c6f2-11eb-8dde-b03b42a0a03a.png"> | <img width="712" alt="Screen Shot 2021-06-06 at 18 09 09" src="https://user-images.githubusercontent.com/74188/120946737-5d9eb700-c6f2-11eb-8563-8d9b8d8e075b.png"> |

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#539

## Any other notes
- Only works on macOS for this first round. The iOS implementation will be the same manager, but needs extensions scaffolding that I have to put together separately.
- iOS will also likely have a setting to control this behavior, since it has potential battery implications; macOS doesn't have such concerns.
- Adds tests around the parsing of the raw notification payloads that uses the same tests introduced in home-assistant/mobile-apps-fcm-push#55.
- Shows the state of the local push connectivity in Notifications. With multi-server support, this will probably need to be broken down by server, or moved into the server-specific configurations.

This also sets us up to support encrypted notifications, since we're now able to handle the service call's data without any kind of remote manipulation. Unfortunately Apple declined the entitlement which makes this extremely easy, so we'll still need to handle the "commands are unencrypted" nonsense.
2021-06-07 19:22:35 -07:00
Zac West
0f2cc94b5c
Manual complication updates via notifications (#1615)
Depends on home-assistant/mobile-apps-fcm-push#52. Fixes #1046, though not in the best way. However, this at least leaves it open to doing it better later.

## Summary
Adds support for triggering complication updates indirectly via background notifications to the iOS app, and adds a manual update button to the complication list.

## Screenshots
![Image](https://user-images.githubusercontent.com/74188/116802546-6c2cf980-aac8-11eb-913a-6b9df9153ede.png)

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#511

## Any other notes
This indirect method appears to be a bit slower than the direct method, but seems to mostly work.
2021-05-10 20:13:55 -07:00
Zac West
7bc64d79a0
Fix events not firing from watch dynamic notification actions (#1618)
Fixes #1604.

## Summary
Dynamic actions -- unlike category-based -- appear to never forward their action handling to the iOS app, despite what the documentation says. Adds tooling to do call it manually.

## Any other notes
Not setting the notification delegate doesn't resolve this, either -- it doesn't appear we're doing anything unexpected, this is just an undocumented/rarely-used area, I guess.
2021-05-02 18:09:24 -07:00
Zac West
5a844d80e3
Handle multiple dynamic actions with the same identifier (#1599)
Fixes #1593.

## Summary
Suffixes the given identifiers with a consistent string, split when sending anywhere.

## Any other notes
Since Android requires an action identifier of 'URI' to open URLs, users may enter more than 1 in the actions array; this fixes using just the first matching identifier.
2021-04-22 20:18:08 -07:00
Zac West
1b88de68a6
Dynamic, per-notification actions (#1588)
Depends on home-assistant/mobile-apps-fcm-push#47 which allows the actions to be included in the notification data, and also on-the-fly silently sets the category to `DYNAMIC` which this requires.

## Summary
Allows for specifying the actions for a notification on-the-fly without defining a category. This should allow us to make all of the category config and setup unnecessary, so I'll probably consider marking it as deprecated in this release.

## Screenshots

For a notification that looks like…

```yaml
service: notify.mobile_app_iphone
data:
  title: title here
  message: body here
  data: 
    actions:
    - action: "id1"
      title: "id1 title"
      # this mirrors the action definition in yaml now, it just _also_ supports what android 
    - identifier: "id2"
      title: "id2 title"
```

![Simulator Screen Shot - Apple Watch Series 6 - 40mm - 2021-04-17 at 20 54 33](https://user-images.githubusercontent.com/74188/115135570-5b5f8c80-9fce-11eb-9118-0d156578d9e5.png)
![Simulator Screen Shot - iPhone 12 Pro - 2021-04-17 at 22 41 07](https://user-images.githubusercontent.com/74188/115135572-60bcd700-9fce-11eb-81b6-c908da8e204c.png)

## Link to pull request in Documentation repository
- Documentation: home-assistant/companion.home-assistant#496

## Any other notes
- Dynamic actions are visual - we provide custom UI on both iOS and watchOS for the additional actions, which does require we run the app on the given platform; for example, this doesn't yet work on macOS [I need to figure out how to make Catalyst notification content work, if it is] and if you uninstall the watch app these actions will not show up.
- Allows `map` and `camera`-esque notification content on any category. In other words, if you send a notification with `map` it'll still prefer the camera `entity_id` if present. This is largely to continue in the direction of making category deprecated; as long as the content extension launches, it'll figure out what to display.

All of the normal action configuration is allowed in these actions:
- action or identifier
- title
- authenticationRequired (default: false)
- behavior (default: default, aka not textinput)
- activationMode (default: background)
- destructive (default: false)
- textInputButtonTitle (default: nil)
- textInputPlaceholder (default: nil)

Some additional things occur to match existing Android functionality:
- `uri` (or `url`) being provided in the action makes it a 'foreground' action
- action/identifier of `REPLY` changes the behavior to textinput
- `mobile_app_notification_action` is now fired with data that looks like theirs:

```
Sending action: mobile_app_notification_action
payload: ["action": "REPLY", "reply_text": "Reply text"]
```

and

```
Sending action: mobile_app_notification_action
payload: ["action": "id1"]
```
2021-04-19 04:28:39 +00:00
Zac West
db90dd2639
Add app support for clear_notification command (#1589)
Fixes #258. Depends on home-assistant/mobile-apps-fcm-push#48 which adds support for the command.

## Summary
Adds `clear_notification` to remove notifications. This behaves like Android which can only clear based on the `tag`/`collapse-id`.

## Link to pull request in Documentation repository
- Documentation: home-assistant/companion.home-assistant#497

## Any other notes
This may be unreliable as it depends on the app launching in the background to do the actual clear.
2021-04-18 21:12:21 -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
28d9ec6fe0
Reset push ID when resetting everything else (#1559)
Fixes #1312.

## Summary
After resetting user defaults, where we store the push ID, this sets a new value through so it'll be used during the next registration.
2021-03-28 22:51:31 -07:00
Zac West
fbc2c7bd5e
Handle my.home-assistant.io links on iOS (#1497)
## Summary
Handles being launched by universal links (e.g. https://my.home-assistant.io/redirect/logs) or via the url scheme `homeassistant://navigate/path/to/lovelace`.

## Screenshots
https://user-images.githubusercontent.com/74188/109757851-7487b780-7b9f-11eb-923d-5388964d85a5.mov

## Any other notes
This doesn't yet work on Mac, because my initial `WKWebView` implementation doesn't want to give us any events about URL schemes like `homeassistant://…` being tapped. I'm unsure how useful it'll be on Mac either way, but at least the `homeassistant://navigate/xyz` will still work there.
2021-03-04 02:28:59 +00:00
Zac West
433dde3ed0
Fix location settings for siglog changes & zones (#1478)
## Summary
The "Significant Location Change" and "Zone enter/exit" settings for Locations' Update Sources previously did not work. This now watches both settings for changes and handles enabling or disabling their respective monitoring.

## Any other notes
- It takes a few seconds for the location-in-use arrow to disappear after disabling them.
- Users may be a little surprised if things _stop_ working, since they may have toggled these off for some reason in the past.
2021-02-11 20:58:25 -08: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
c6167742f2
Revert PromiseKit threading change (#1431)
- Reverts #1418 - there's enough logic that is relying on the single-threadedness of then/map-ing on a shared queue.
- Forces all `Current.api` access to be done not on a queue intentionally, to avoid thread jumping when we don't expect, which is the core crash that this was trying to fix.
2021-01-26 21:11:53 -08:00
Zac West
5b75b2ea4c
Move API access into Environment (#1390)
Consolidates REST API access into one entry point, ish.
2021-01-21 20:45:42 -08:00
Zac West
91de019723
Move UNNotification & FirebaseMessaging into its own manager (#1287) 2020-11-21 13:13:34 -08:00
Zac West
77c72785ff
Update a few more housekeeping things in the project (#1142)
- Combines all .entitlements into either: App-iOS, App-catalyst, WatchApp, Extension-iOS or Extension-catalyst.
- Cleans up and renames all the schemes to match target names
- Moves around several folders and deletes some old files.
- Converts Podfile to be hierarchical, rather than calling shared methods.
- Always runs MaterialDesignIcons script; aborts early if it's up-to-date.
- Updates all dependencies.
2020-10-03 16:05:19 -07: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