Commit Graph

82 Commits

Author SHA1 Message Date
Bruno Pantaleão Gonçalves
16f5a1bc75 Simplify and migrate onboarding screens to SwiftUI (#3527)
<!-- 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. -->



https://github.com/user-attachments/assets/e79c6e4d-13ff-405a-9463-02e597ce4996
2025-04-08 23:54:34 +02:00
Fábio Oliveira
d9bf9d423e Snapshottable preview configuration (#3494) 2025-03-21 15:39:12 +01:00
Bruno Pantaleão Gonçalves
0773a9a8fc Revert "Create SharedTesting framework target" (#3493)
Reverts home-assistant/iOS#3487
2025-03-20 11:18:58 +01:00
Fábio Oliveira
ab4de6a1f5 Create SharedTesting framework target (#3487)
<!-- 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
Put together a technique to reuse previews to generate and assert
snapshots.
This either saves time writing snapshot tests or makes snapshot tests
more useful by using them as previews.

This is implemented in a couple of libraries already
([example](https://github.com/BarredEwe/Prefire)). Went with a simple
implementation here but a library can be adopted to leverage additional
features and support.

To hold the code for snapshotting, a new framework was introduced,
SharedTesting, to collect all the utilities built for testing. It must
only be imported in test targets.

The preview side of the code lives in the Shared framework.

Applying this new technique will come in a separate PR.

[Original PR](https://github.com/home-assistant/iOS/pull/3484)

---------

Co-authored-by: Bruno Pantaleão Gonçalves <5808343+bgoncal@users.noreply.github.com>
2025-03-20 09:33:55 +01:00
Bruno Pantaleão Gonçalves
c028a943da Added widget builder (#3354)
<!-- 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 -->
First iteration of the widget builder, user is able to choose what
entities to display, choose a display text for them, color customization
and "on tap" 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/5949322a-a8df-4b3d-aaab-d4ba3853cc84


## 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-01-27 16:16:24 +01:00
Bruno Pantaleão Gonçalves
30a81b015f Use home assistant defined thread network when commissioning matter device (#3027) 2024-09-25 00:03:47 +02:00
Bruno Pantaleão Gonçalves
aa2b4ebad3 iOS18 Assist control (#2972)
<!-- 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. -->
![CleanShot 2024-09-03 at 11 11
29@2x](https://github.com/user-attachments/assets/3551f526-a2e7-42ec-a5ee-732c3daec7e1)

## 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-09-03 16:51:49 +02:00
Bruno Pantaleão Gonçalves
d8c561d85d Add "Script" iOS 18 ControlWidget (#2952)
<!-- 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 also adds a dependency: `SFSafeSymbols` to safely iterate over
SFSymbols. For ControlWidget we can't use MaterialDesign icons, unless
they are converted into custom SFSymbols and embedded in the App but
this would increase a lot the App size

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
![Simulator Screenshot - iPhone 15 Pro - 2024-08-29 at 04 17
08](https://github.com/user-attachments/assets/907603f3-a132-43d0-a8ed-1c138b545080)



## 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-29 11:18:51 +02:00
Bruno Pantaleão Gonçalves
9352824c6d Fix haptics on scripts widget (#2928)
<!-- 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-08-20 11:22:10 +02:00
Bruno Pantaleão Gonçalves
8c61c5780b Workaround to avoid iOS 18 crash widgets that use Realm (#2919) 2024-08-15 11:47:59 +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
0e2bc3bae6 Fix "Open page" widget not loading options (#2872) 2024-07-26 19:56:01 +02:00
Bruno Pantaleão Gonçalves
86e7c7b2ab Simplify widgets and small UI tweaks (#2863)
<!-- 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="977" alt="Screenshot 2024-07-23 at 12 05 34"
src="https://github.com/user-attachments/assets/99094b2f-66da-4e6d-8c02-361e165b13cd">

## 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-23 13:53:52 +02:00
Bruno Pantaleão Gonçalves
0c0df1ac3b Allow 2 items in systemSmall widget + update Apple Watch item style (#2861)
<!-- 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:19 +02:00
Bruno Pantaleão Gonçalves
879e8674b6 Redesign widgets to align with HA tiles UI (#2852) 2024-07-18 17:43:44 +02:00
Bruno Pantaleão Gonçalves
995df183bc Register material design font for Assist widget (#2737) 2024-04-25 09:41:16 +02:00
Bruno Pantaleão Gonçalves
3ea5ccab80 Add missing languages so Lokalise pipeline can succeed (#2457)
## Summary
Add missing languages so Lokalise pipeline can succeed
## Screenshots

## Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

## Any other notes
2023-11-28 16:06:54 +01:00
Zac West
2bdc12ab83 Add Matter extension & allow commissioning from the frontend (#2267)
<!-- 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. -->
2023-01-10 16:50:51 +00:00
Zac West
60ac777069 Fix warnings in Xcode 13.3 (#2053) 2022-02-02 09:22:36 -08: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
b053654829 Update to Xcode 13.1, add macOS 12 features (#1892)
* Update to Xcode 13.1, add macOS 12 features

* Settings check update

* Swap to Eureka fork which compiles

* Fix pushing twice during notification permission
2021-10-21 06:11:33 +00:00
Zac West
e969f380f6 Minor Xcode 13 version upgrade changes (#1861)
## Summary
Xcode wants to do these, and I toggled on ccov on random schemes so switching schemes doesn't cause a full recompile.
2021-09-25 23:28:27 -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
aff61b9c0a Add xcscheme changes from executable changes (#1631) 2021-05-08 09:50:24 -07:00
Zac West
147a076095 Static video/audio attachments in dynamic category (#1597)
Fixes #1591.

## Summary
Adds support for using video and audio notification attachments in the content extension, including audio playback for both.

## Screenshots
https://user-images.githubusercontent.com/74188/115503572-7c70e900-a22b-11eb-970b-b4e9c2225986.mov

## Any other notes
Dynamic actions require the 'DYNAMIC' category but our content extension causes attachments to not appear and we want every possible feature to work with just this category.
2021-04-20 23:31:38 -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
982ddd0325 Fix another sub-100m zone fuzzed accuracy enter issue (#1575)
## Summary
When the accuracy is fuzzed based on a region enter, we need to use that fuzzed location for the next fuzzer.

## Any other notes
To make it less easy to make this bug happen again (where the intermediary fuzz value is ignored), this moves them to be reducing the same variable in a row.

Also fixed the test case for this flow to explicitly have this double-up requirement.
2021-04-07 02:00:20 +00:00
Zac West
c9830a80af Set up GitHub Actions-based automatic builds (#1442)
## Summary
- Creates a Developer ID build, notarizes it, staples and then makes a .zip out of it.
- Re-exports the same Developer ID build for the Mac App Store and uploads it.
- Creates an iOS App Store build and uploads it.
- Uploads dSYMs and other debug information to Sentry during the build.
- Builds for every push to master. Does not automatically expose to beta users, at least not yet. But for internal TestFlight this should produce the latest and greatest as it goes.

## Any other notes
- Necessitates doing an automatic incrementing number for the build number, since it must be monotonically increasing for macOS builds. Uses the format `2021.{RUN_NUMBER}`.
- Moves to use manual code signing for Release builds. It was already this way before (we were just using the Xcode UI at submission time specify), but now it doesn't require fiddling.
- Changes Firebase config to be not in a scheme. When it's in a scheme, it's after the code sign phase, which can produce issues for Fastlane.
- Changes Firebase to not be an xcframework in CI, since they do not ship ARM Mac Catalyst slices yet.
- Removes some incorrect code sign statuses in the Mac Launcher app.
2021-01-31 10:09:33 -08:00
Zac West
b80c874917 Add code coverage reporting to tests (#1412)
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.
2021-01-24 10:53:43 -08:00
Zac West
f550199526 Add "Launch App on Login" setting (#1387)
Fixes #1383. Refs #949.

## Summary
Allows the user to choose to launch the app on startup, which toggles on a login item which launches the app.

## Screenshots
<img width="350" alt="Screen Shot 2021-01-18 at 13 03 28" src="https://user-images.githubusercontent.com/74188/104962618-aa753180-598d-11eb-8711-f3b45ded80ba.png"><img width="350" alt="Screen Shot 2021-01-18 at 13 03 23" src="https://user-images.githubusercontent.com/74188/104962622-aba65e80-598d-11eb-8c76-e6ec61fe320a.png">

## Any other notes
- Effectively this setting turns on whether to launch this Launcher app on login, and then the Launcher app launches the app whenever it's started, before terminating itself.
- Routes through the Mac Bridge to call `SMLoginItemSetEnabled` which appears to have no public API counterpart to get the current status. Various places point to `SMJobIsEnabled` which doesn't appear in any headers.
- Thanks @rudyrichter for the pointer on how to get this working.
2021-01-18 16:19:58 -08:00
Zac West
784c3ffeb7 Move SwiftGen/SwiftLint execution to an aggregate target (#1375)
- Saves a few seconds of incremental build time, especially by using input/output file lists for swiftgen.
- Fixes changing e.g. Localizable.strings not immediately taking effect in any target other than the main app.
2021-01-15 21:24:36 -08:00
Zac West
8ed37f02d4 Update notification attachment handling, add error images (#1301)
## Summary
- Refactors notification attachment into smaller units. Adds tests.
- Adds an image attachment with whatever the error reason is when an attachment fails to download.
- Adds a Shared framework scheme which can run just its tests. It's a bit faster than doing the whole app which has a lot of extensions and watchOS targets.

## Screenshots
![Image](https://user-images.githubusercontent.com/74188/102575375-d4de8100-40a7-11eb-868f-d19b60710bf7.PNG)

## Any other notes
This does not (yet?) create the error images for the service timeout. Not sure how relevant that may end up. I haven't yet come across a case of this happening in logs and being confusing.
2020-12-17 23:10:17 -08:00
Zac West
b9dde39e4e Support multiple Apple Watch complications (#1197)
This allows for configuring more than 1 e.g. Modular Small at a time. This requires watchOS 7; for releases before watchOS 7 we do not allow a secondary template to be created. This could be improved by allowing swapping between one of the multiple for watchOS 6 and earlier, but I didn't implement this.

- Adds a "Display Name" to Complications. This is optional and falls back to the template type. This is primarily to differentiate complications; the underlying unique ID is just a UUID.
- Enable previews of complications, which is used when selecting them. This is a stripped-down version of the items in the template, usually just an icon provider or one of the text providers. This is largely easier now since we're now requesting templates for all complications, even those not actively visible.

This also changes the flow when setting up initially. Instead of a list of families to choose from at the start, the user must tap the 'Add' button and pick one from there.

Fixes #839.
2020-10-16 19:42:42 -07:00
Zac West
7f70fd45f8 Fix Watch Extension entitlements, libsodium.a removal for iOS (#1150) 2020-10-04 12:57:29 -07: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
Zac West
7841f1c9ce Fix Mac Bridge to be accessible from extensions, fix libsodium.a deletion (#1113)
- The previous deletion of the Frameworks directory was just for the folder, and not recursive, which didn't work.
- Moves MacBridge.bundle into Shared.framework's PlugIns so it is accessible in extensions, which now creates yet-another `libsodium.a`, so the deletion is now recursive. This xcframeworks bug, yikes!
2020-09-27 14:14:21 -07:00
Zac West
81a3b0b71e Bump to 2020.7 (2)…and work around some code signing issues (#1062)
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.
2020-09-20 16:58:24 -07:00
Zac West
f6333de587 Initial support for Catalyst/macOS (#931)
- 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.
2020-08-23 16:01:01 -07:00
Zac West
b978e98cb3 Update dependencies, fix warnings (#913) 2020-08-15 23:02:03 -07:00
Zac West
17b7e50fe9 iOS 14 Widget: Actions (#890)
Adds a new widget: "Actions" which can hold some number of actions: small (1), medium (1-4), large (1-8).Each action displays based on the text, icon, and background configuration that already exists.

When tapped, the actions launch the app and perform the action. This is an Apple restriction - Widgets cannot execute code when interacted with; they can only launch the app when tapped. Apple gives special permission to their Shortcuts widgets to change this behavior, of course, because all developers are equal but some are more equal than others.

I took "inspiration" from the general layout of most Widgets, but I really don't like the wasted space that Apple does with some of their widgets. For example, the Shortcuts widget draws margin after margin after margin around the actions. This does not. They also force you to have a bunch of blank ones if you don't have exactly the number they want. This fills as best as possible, even if it means making widgets (gasp!) larger than the smallest possible size.
2020-08-14 23:58:45 -07:00
Zac West
5250064079 Fix Xcode 12, add Widgets extension (#883)
- Upgrades the project file format from very old Xcode compatibility to 11.4+.
- Updates to Cocoapods 1.10 beta.
- Removes some overrides of the xcconfig and updates the xcconfig.
- Adds exclusions for the x86_64/64-bit watchOS simulator using new b4 format.
- Updates intents for iOS 14/Xcode 12.
- Adds an Intent-powered Perform Action widget (which does nothing and isn't styled) to make sure the flow works. It's actually not possible to define an empty set of widgets if the extension exists, so it needs something.
2020-08-10 20:33:39 -07:00
Zac West
35768bb45b Fix infinite loop syncing Actions to watch (#862)
This happens because the Mappable-variant encode/decode of an Action requires a write transaction (since ObjectMapper's mapping is `inout`, which triggers the "only set in a write transaction" check in Realm) which then, directly, caused a new update to the Watch.

Worked around this by making Action and WatchComplication sync via ImmutableMappable which does not do anything inout, and thus doesn't require a write transaction.

Fixes a few more issues:
- Setting shortcutItems and syncing to watch is now done entirely in the Actions observer; removed from Settings.
- Fix iPhone-not-connected action sending for Scene-synced Actions, which don't have their RLMScene synced to the watch.
- Fixed the empty state label not hiding if actions go in or out of 0-count after initially.
2020-08-02 14:34:29 -07:00
Robbie Trencheny
5c2548b47b Xcode 12 scheme update 2020-07-28 20:12:22 -07:00
Zac West
8eefdfda3f Xcode 12 compatibility fixes (#829)
- Temporarily disables the new 64-bit watchOS simulator, which allows building again until Realm and Sodium are updated to support it.
- Fixes deployment targets set by Cocoapods.
- Fixes recommended warnings and other new flags from the new SDK.
2020-07-25 13:34:28 -07:00
Robbie Trencheny
e2d800838b Fix Crashlytics (#738) 2020-07-07 11:40:40 -07:00
Zac West
aad17dc3e0 ZoneManager: Rewrite & Test Region Monitoring (#698)
- Rewrites the region monitoring into several smaller, more testable pieces.
- Does a one-shot location update whenever a region's state changes.
- Writes a whole lot of tests around it.
- Still wraps it in the "In-Development Updating" setting flag so I can get beta feedback and iterate.

Replaces #697.
2020-06-25 23:55:15 -07:00
Zac West
6cb163b03d Camera Notifications: Play HLS Stream (#652) 2020-06-18 20:33:23 -07:00
Zac West
c1ed1e37b4 Notifications: Camera Aspect Ratio (#650)
- Adjusts the constraints on the preview image view while it vends so it isn't stretched. Fixes #513 / #167.
- Adds a sample .apns which can be used to trigger a Camera notification more easily.

Looking through the server code, it looks like we can also grab an HLS stream, which is what the frontend is using for previewing the camera. Refs #596. Created a ticket remember this as #649.
2020-06-15 10:26:37 -07:00
Zac West
a35c493bd8 New One Shot Location Logic (#623)
- Adds a thin wrapper around the old logic, which allows users to swap between the two, reducing the scariness of this PR.
- Wraps manual location updating in the same background task logic as background ones.
- Adds background time remaining (when available) as a part of the background task logic, so we can pipe that into the location updating logic, too.

This new logic is focused around: how many updates can we get and how much accuracy can we hit if we give Location Services a few more seconds to feed us location data? I've plugged in some random guesses at how long we're willing to tolerate these things.

Indications are that iOS is willing to toss us things like 2500m accuracy in some situations, which is a heck of a lot of drift for a background fetch update. We're being given an opportunity to do some background work, so it feels like a good time to try and use it, too.

It might be worth considering adding some analytics here to try and get a better handle on how often we have either no location, a mediocre location, or a perfect location.
2020-06-12 20:40:10 -07:00