20 Commits

Author SHA1 Message Date
Michal Šrůtek
3146e08aac
Available checks cleanup for iOS 15 and watchOS 8 (#2622)
<!-- 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>
2024-03-04 15:36:55 +01:00
Michal Šrůtek
08781c19f0
Remove default options parameter (#2621)
<!-- 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 removes the `options` parameters which use the default value.

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

<img width="1014" alt="Screenshot 2024-03-03 at 21 17 55"
src="https://github.com/home-assistant/iOS/assets/35694712/85324caf-c36d-4366-a9f8-9c349192a361">
<img width="1049" alt="Screenshot 2024-03-03 at 21 17 17"
src="https://github.com/home-assistant/iOS/assets/35694712/cebddbe6-8ea4-415e-b12a-0e35f86bf5a3">
<img width="1022" alt="Screenshot 2024-03-03 at 21 16 53"
src="https://github.com/home-assistant/iOS/assets/35694712/ccccb902-9791-42f6-8868-5900093c40ae">
<img width="991" alt="Screenshot 2024-03-03 at 21 16 28"
src="https://github.com/home-assistant/iOS/assets/35694712/f2f33685-a55c-47ed-a555-8cc0fc1561ce">
<img width="1329" alt="Screenshot 2024-03-03 at 21 16 00"
src="https://github.com/home-assistant/iOS/assets/35694712/2dc156da-29d6-44e4-a064-4fbdb79139bd">
<img width="1130" alt="Screenshot 2024-03-03 at 21 14 53"
src="https://github.com/home-assistant/iOS/assets/35694712/628dd2ff-5bba-4ee7-912b-cdbdf73f18b2">
2024-03-04 09:28:53 +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
Zac West
b465c94145
Fix complications not updating in 2021.12 (#1977)
Fixes #1955.

## Summary
We were not updating any complications watch-side, so any updates exclusively came from the iOS app's updating them.

## Any other notes
Complications weren't syncing over to the watch with their serverIdentifier value set, so when we went to update none of the API instances thought their server had any complications needing updating.
2021-12-07 03:16:10 +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
cea0b16936
Update dependencies (#1883)
- Updates several dependencies
- Removes Lokalise -- if we can't do it on Catalyst, it doesn't feel worth it to do it elsewhere
- Migrates the NotificationTestCases from a Podspec that keeps having issues to a fastlane script which copies in the latest ones
2021-10-16 15:19:41 -07:00
Zac West
bb53bdd5e5
Xcode 13 (#1841) 2021-09-18 19:42:29 -07:00
Zac West
640cca884b
Add SwiftFormat to project (#1463)
Adds new fastlane lanes:
- `fastlane lint` which checks the linters
- `fastlane autocorrect` which applies the linters which can autocorrect (Rubocop, SwiftFormat)

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

Applies SwiftFormat to nearly all code -- exempts a few externally-sourced files and generated code.
2021-02-05 22:06:25 -08:00
Zac West
adf0ad6bab
Fix Graphic Bezel Circular Text & Graphic Rectangular Standard Body (#1457)
Fixes #1437.

## Summary
Fixes the optionality on the text providers in these two styles.

## Any other notes
Went through all of the complication definitions, again 😆, and these were incorrect optionality. It will be nice to move these to the watchOS 7 init methods which are less…problematic.

- Bezel Circular Text has its text provider optional, we do not need to force it.
- Rectangular Standard Body has 3 text providers: header, body1 and body2. Only header and body1 are required, body2 is optional.
2021-02-04 05:35:42 +00:00
Tom Brien
55d472c93e
Allow hiding complications when watch is locked (#1253)
* Allow private complications

* Add string

* Add british string, tea and crumpets and what not

* Move row

* Probably want to save setting...

* No idea when this moved...

* Fix logic

* Tweak migration

Forgot to commit this earlier

* Bump schema

* Flip logic

* Add helper

* Change func name

* Use helper in template func

* Update function name

* Tidy up

Co-authored-by: Zac West <74188+zacwest@users.noreply.github.com>
2020-11-02 09:21:03 -08:00
Zac West
f5b99fe47a
Remove SPM (🎉) and upgrade deps (#1242)
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.
2020-10-25 20:13:52 -07:00
Zac West
6528b9e548
Avoid generating invalid templates due to non-optional fields (#1222)
This resolves a crash on watchOS 6 when a Complication Template is missing required fields (e.g. one of the text providers) and instead returns the 'error' template.

watchOS 7 wasn't exactly better as it would not crash but it wouldn't be obvious about the error happening, so this also improves that situation.

This is a half-measure to telling the user which fields are optional or not when editing the complication, but it should be a _lot_ more obvious when we do not have the information necessary to make the template.
2020-10-20 22:42:00 -07:00
Zac West
413d3a42bc
Fix Complication Ring/Gauge values in locales using , as decimal separator (#1206)
In HA versions prior to 0.117, the template rendering returns strings for floats using `.` as the decimal separator. If the user's current locale uses `,` as the separator, our string to number parsing here fails to understand what the number is. Since it's freeform text, this also needs to fall back to using the locale-aware formatter in case they typed manually something like `0,33`.

Fixes #1188.
2020-10-18 09:01:17 -07: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
a2a9b8266b
Handle non-String template rendering (#1187)
- Converts to String for the API-like things we provide for template rendering: intent handling and x-url-callback.
- Handles various kinds of results for Complication template handling: tries to smooth values to floats for percentile-based rings and gauges, describes via String for anywhere else.
- Adds a small amount of validation when entering templates in a Complication's Configuration.

Fixes #1177. Fixes #1180.
2020-10-15 21:17:51 -07:00
Zac West
d37e9f867f
Fix non-English Gauge/Ring, fix Column 2 Alignment (#1186)
These styles were using the localized strings as options, which were then not equating. The way the current getters work, their failure to exist in the dictionary it would always use 'ring' for Gauge and 'closed' for Ring.

Replaces Row 2 Alignment (which had a similar issue) with Column 2 Alignment, which is what the complications want. This right-aligns the second columns.
2020-10-13 21:11:55 -07:00
Zac West
36fdb37249
Improve reliability of refreshing Watch Complications (#1168)
One of our top crashes (on all platforms) is crashing when completing the background refresh operation of the Watch Extension's update cycle. I believe this is because the task is being called more than once; presumably because we're mixing multiple types of tasks in one pointer -- communication updates and complication updates, and they stomp on each other.

Another issue here is that we're not using Background Sessions to do the complication updates, when we want to -- when I refactored Webhooks out of the HomeAssistantAPI code path, I neglected to update this Webhook call to handle background updating; it now does.

- Updates complication text rendering to go through the background session supporting Webhook update mechanism.
- Adds support for ring and gauge template rendering. Fixes #1127.
2020-10-10 13:38:13 -07:00
Zac West
53ecc94bf2
Fix ring and single-color-tinted Watch Complications (#1170)
- Fixes, in general, any complication involving a Ring -- none of the values were being persisted in a way it could understand and color was missing entirely.
- Fixes Extra Large's "Simple Image", "Stack Image", "Ring Text" and "Ring Image". Fixes #1165.
- Fixes Utility's Small "Square" image (the size name was wrong), "Ring Image" (same as above), "Ring Text". Fixes #1164.
2020-10-09 11:02:34 -07:00
Zac West
ceafb85346
Implement Graphic Bezel Circular Text (#1169)
Requires an icon; adds the flag that we need the icon for the template and sets the image size.
2020-10-08 23:38:08 -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