<!-- 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>
<!-- 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. -->
<!-- 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. -->
<!-- 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 -->
To avoid using internal URL out of local network, this PR makes
"activeURL" optional, and it will not use internalURL when out of local
network.
Tested the internal/external logic on:
- iPhone
- iPad
- Mac
- Watch
- Shortcuts
- Notifications
- Widgets
For VPN users, they have to set external URL the same as internal URL to
have their setup working.
Pending:
- [x] Verify all edge cases where "guard let" were added
- [ ] Enforce SSID to use internal URL in the App
Next possible iteration:
- Add noise protocol between app and server to make http connections
secure
## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
<img width="1154" alt="Screenshot 2024-05-13 at 11 46 47"
src="https://github.com/home-assistant/iOS/assets/5808343/7ea634cc-382b-49c2-ab64-a218f996452e">
## 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. -->
<!-- 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. -->

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. -->
<!-- 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. -->
<!-- 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. -->
<!-- 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 the [minimum watchOS is
8](https://github.com/home-assistant/iOS/pull/2609) and [minimum iOS
15](https://github.com/home-assistant/iOS/pull/2469), this PR removes
redundant `#available` checks.
Co-authored-by: Bruno Pantaleão Gonçalves <bruno.ing879@gmail.com>
## 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
## Summary
During onboarding, allow trusting an invalid certificate chain for most features of the app.
## Screenshots
<img src="https://user-images.githubusercontent.com/74188/170773293-14eeb3fb-2e54-42a5-b6c6-8b07c792ea24.png" width="300">
## 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
Future changes necessary:
- Trusting certificates if an error occurs while the app is running
- Trusting certificates when configuring internal/external URLs
Refs home-assistant/core#67429.
## Summary
Fixes the logic for decryption to use the full key, rather than half of it, when decoding/encoding the additional encryption we use for webhooks only.
## Any other notes
This encryption is largely superfluous in the era of Let's Encrypt's dominance, but we're going to be reusing it for end-to-end encrypted notifications.
## Summary
When set to "None", all sensors sent to the server will be redacted.
## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#644
## Any other notes
This also updates location when changing location privacy & sensors when changing sensor privacy, so the data server-side will be most-up-to-date.
Starting in iOS 15, there's a number of crashes happening in the background with Realm. They don't appear to be due to the file lock in the shared app container, but this may help resolve them either way -- easy to see if the next beta doesn't crash a bunch.
Fixes regression in #1487.
## Summary
Ephemeral webhook sends do not have any persisted info on them, and that's to be expected.
## Any other notes
None.
Fixes#1473. Again.
## Summary
When we issue webhook requests, we were failing to cancel any previous requests (which want to be cancelled) that were executed on not-the-background session. This moves to now checking both the background and non-background for cancellable requests.
## Any other notes
- Moves to explicitly cancelling, rather than silently replacing and succeeding, replaced requests. For example, a sensor update will now be explicitly cancelled if a new sensor update comes through, rather than following the success path.
- This resolves an issue where a sensor update occurs, fails on the non-background session, and retries with the same request data on the background session. This can lead to an older sensor update request, with outdated information, happening long after the most recent and correct one finishing.
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.
## Summary
Maybe fixes a few crashes happening on watchOS that look like the iOS 14-era background crashes around file locks.
## Any other notes
I'm pretty sure Realm is working around the watchOS crashes by doing some kind of different file lock, so it's possible that we're entering the background and being killed for being in a write at the same time. All of these crashes have the infamous 0xdead10cc code.
This may address crashes which look like:
```
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace RUNNINGBOARD, Code 0xdead10cc
Triggered by Thread: 0
```
As well as ones that are crashing deep in Realm during a write:
```
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace RUNNINGBOARD, Code 0xdead10cc
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x21431508 mkfifo + 8
1 Realm 0x055d17d0 realm::util::File::lock+ 3217360 (bool, bool) + 476
2 Realm 0x0542f51c _hidden#8599_ + 76
3 Realm 0x0543094c realm::DB::get_number_of_versions+ 1509708 () + 32
4 Realm 0x05775260 _hidden#13450_ + 116
5 Realm 0x05774ea4 realm::Realm::begin_transaction+ 4935332 () + 64
6 Realm 0x053603d8 _hidden#6536_ + 656344 (__hidden#6695_:0)
7 RealmSwift 0x05a5b5a4 Realm.write<A>(withoutNotifying:_:) + 275876 (__hidden#4565_:0)
8 Shared 0x05cbfda4 closure #4 in WebhookResponseUpdateComplications.handle(request:result:) + 252 (WebhookResponseUpdateComplications.swift:69)
…
```
among many, many others. Only on watchOS 7. I'm not sure why this has begun crashing in the betas; perhaps updating Realm is causing new code paths, or more likely we're doing something slightly different timing-wise.
- 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.
Adds code coverage reports to pull requests. Enabling code coverage gathering appears to be about a 25% increase in build time, unfortunately, so just enabling it for the App/Shared targets and doing it in a separate scheme so it doesn't impact local build times.