<!-- 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. -->
Words cannot describe how bad SPM is. For the future record, here are the big reasons:
- Xcode fails to find Swift Package Manager Binary Target dependency… FB8743041
This manifests as "cannot find module Clibsodium" or "Realm" or whatever.
- Xcode Swift Package Manager checkout retry has 0-second delay FB8742078
Xcode's built-in version of git/curl has bugs with pipelining, forcing us to replace it with another version to get ci to be more reliable.
- xcframework via Swift Package Manager both statically links to library and embeds it FB8721223
This requires us massaging the output build products because Xcode produces invalid binaries, which fail all the validation Apple does on App Store Connect upload and on Developer ID Notarization.
-----
In total, this means using SPM produces invalid builds, often fails to build correctly, and often fails to check out dependencies correctly. What a let-down.
- 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.
Starting in the 12.0gm (but not 12.0b6) and in 12.2b1, when our Shared.framework has a dependency on Sodium's xcframework-via-SPM, it is both statically linked into the binary of the framework and copied into Frameworks/. This causes codesign to fail, because it is not expecting a binary file inside.
Reproduced this in a sample project and filed FB8721223 -- it is certainly not expected behavior. Doubly fun if is the presence of this .a causes e.g. notarization to fail. This requires manually removing the directory in Shared.framework. This can't be done as a build phase in Shared.framework because Xcode is doing the incorrect file copy _after_ all build phases, so I put it as a post-build scheme script for the Debug and Release schemes.
Realm 5.3.6 has a workaround for the iOS 14 b3-b6 (but reverted by Apple in b7) crash. However, this workaround also causes deadlocks/crashes restoring form the background on iOS 12 and below. This reverts to the build before the regression, which will cause us to crash on the previously-noted iOS 14 betas, but will make iOS 12 and 11 work as expected.
This also fixes the alert we present when the Realm can't be be set up, which broke for Scenes.
Fixes#1020.
- Bumps Realm to 5.3.6 to fix#822. Removes the hacky workaround. Refs #907 -- if this does not fix it, please let us know.
- Fixes the Update checker (for Mac) incorrectly firing on iOS, along with a couple other places that I used `#available(macCatalyst)` instead of `Current.isCatalyst` (the former is equivalent to `#available(iOS)`.
- Fixes single-scene startup not having a scene immediately causing the delayed WebViewWindowController access to assert.
- Moves Realm & Sodium to Swift Package Manager. Sodium _just_ added support and I fixed a Release issue there.
- Manually removes linking against Lokalise. Their binary distribution hasn't been updated.
- Avoids talking to things not on Mac (NotificationCenter [Today Widget], Core Telephony).
- Fixes registering fonts, which need to specify scope and also avoid complaining if registration occurs twice.
- Hides preferences like Motion, NFC, Apple Watch which are not on Mac.
- Adds a very basic update checker, which looks at the GitHub releases and does an equality check on version info.
This is, of course, not a polished product: settings still open in a form sheet, there's absolutely no useful menu items, no support for multi-window, nor a prettier NSWindow kinda thing.