Files
iOS/Sources/Shared/Notifications
Bruno Pantaleão Gonçalves 797e1018c5 Log silent guard exits in custom widget AppIntents (#4629)
## Summary

Custom widget AppIntents
(`CustomWidgetToggle/Activate/PressButton/UpdateWidgetItemConfirmationStateAppIntent`)
used a single combined `guard` block with a silent `return .result()` on
failure. When a tap bailed out — wrong domain, missing parameters,
server lookup miss, no active URL — nothing was logged anywhere, which
made user reports like
[#4488](https://github.com/home-assistant/iOS/issues/4488) ("widget taps
do nothing on iOS 26.4+") impossible to triage.

Changes:

- Split each guard into separate checks with an `Current.Log.error(...)`
line per failure mode, so the widget-extension log now shows *which*
precondition failed.
- Extract the server/connection lookup into a small
`CustomWidgetIntentHelper.resolveConnection` so the three intents don't
duplicate the same boilerplate.
- When `Current.api(for: server)` returns nil (i.e. `activeURL()` is nil
— server unreachable from this network), dispatch a local notification
("Home Assistant could not be reached…") so the tap no longer silently
does nothing.

No behavior change for the success path. Failure paths still `return
.result()` — they just now leave evidence behind.
2026-05-13 08:59:21 -03:00
..