From 6829318e02ce6a106293810c763c7820747006ca Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 5 Sep 2026 23:51:35 +0000 Subject: [PATCH 1/2] Run Focus filter when the app is in the background A plain SetFocusFilterIntent is only reliably performed while the app is in the foreground, so a Focus that starts with the app closed never reports its name. Conforming the intent to LiveActivityIntent opts it into running in the app's process in the background. That protocol is iOS 17+, so the filter is now gated to iOS 17. --- .../Settings/Focus/FocusNameFocusFilterAppIntent.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sources/App/Settings/Focus/FocusNameFocusFilterAppIntent.swift b/Sources/App/Settings/Focus/FocusNameFocusFilterAppIntent.swift index cd63e8205d..3e06930d25 100644 --- a/Sources/App/Settings/Focus/FocusNameFocusFilterAppIntent.swift +++ b/Sources/App/Settings/Focus/FocusNameFocusFilterAppIntent.swift @@ -6,7 +6,14 @@ import Shared /// The Focus Filter the user adds to a Focus in Settings › Focus, picking one of the names they /// created in the app. iOS runs this when that Focus activates, which is the only moment it tells /// us anything about _which_ Focus is running. -struct FocusNameFocusFilterAppIntent: SetFocusFilterIntent { +/// +/// `LiveActivityIntent` is not about Live Activities here: a plain `SetFocusFilterIntent` is only +/// reliably performed while the app is in the foreground, and silently skipped when iOS would have +/// to launch the app to run it — which is every Focus that starts with the app closed, so the +/// filter misses exactly the moments it exists for. The conformance opts the intent into being run +/// in the app's process in the background, which is what makes it run at all. +@available(iOS 17.0, *) +struct FocusNameFocusFilterAppIntent: SetFocusFilterIntent, LiveActivityIntent { static let title: LocalizedStringResource = .init( "app_intents.focus_filter.title", defaultValue: "Report Focus name" From a4c2e99218e06121b377f4928d6b147cd44b1707 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 5 Sep 2026 23:54:57 +0000 Subject: [PATCH 2/2] Keep the Focus filter available below iOS 17 Declare the LiveActivityIntent conformance in an availability-gated extension instead of on the type, so the filter itself is not removed from the iOS versions that predate the protocol. --- .../Focus/FocusNameFocusFilterAppIntent.swift | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Sources/App/Settings/Focus/FocusNameFocusFilterAppIntent.swift b/Sources/App/Settings/Focus/FocusNameFocusFilterAppIntent.swift index 3e06930d25..fba2aacca6 100644 --- a/Sources/App/Settings/Focus/FocusNameFocusFilterAppIntent.swift +++ b/Sources/App/Settings/Focus/FocusNameFocusFilterAppIntent.swift @@ -6,14 +6,7 @@ import Shared /// The Focus Filter the user adds to a Focus in Settings › Focus, picking one of the names they /// created in the app. iOS runs this when that Focus activates, which is the only moment it tells /// us anything about _which_ Focus is running. -/// -/// `LiveActivityIntent` is not about Live Activities here: a plain `SetFocusFilterIntent` is only -/// reliably performed while the app is in the foreground, and silently skipped when iOS would have -/// to launch the app to run it — which is every Focus that starts with the app closed, so the -/// filter misses exactly the moments it exists for. The conformance opts the intent into being run -/// in the app's process in the background, which is what makes it run at all. -@available(iOS 17.0, *) -struct FocusNameFocusFilterAppIntent: SetFocusFilterIntent, LiveActivityIntent { +struct FocusNameFocusFilterAppIntent: SetFocusFilterIntent { static let title: LocalizedStringResource = .init( "app_intents.focus_filter.title", defaultValue: "Report Focus name" @@ -75,3 +68,14 @@ struct FocusNameFocusFilterAppIntent: SetFocusFilterIntent, LiveActivityIntent { return .result() } } + +/// `LiveActivityIntent` is not about Live Activities here: a plain `SetFocusFilterIntent` is only +/// reliably performed while the app is in the foreground, and silently skipped when iOS would have +/// to launch the app to run it — which is every Focus that starts with the app closed, so the +/// filter misses exactly the moments it exists for. The conformance opts the intent into being run +/// in the app's process in the background, which is what makes it run at all. +/// +/// Declared here rather than on the type so the filter itself stays available on the iOS versions +/// below the one that introduced the protocol. +@available(iOS 17.0, *) +extension FocusNameFocusFilterAppIntent: LiveActivityIntent {}