Some checks failed
CI / build-and-test (push) Has been cancelled
1. Onboarding Habits caption now explicitly mentions the toggles are changeable in Settings, not just times/custom reminder. 2. TaskLiveActivity: removed the checkbox-look circle glyph (hourglass instead). iOS has no API for an app to block the system's swipe/dismiss gesture on a Live Activity -- not attempted. Added a real Stop control via a new StopCountdownIntent (LiveActivityIntent, iOS 17+) embedded directly in the card (lock screen '×' + Dynamic Island 'Stop Countdown' button) -- the actual iOS-supported equivalent of 'long press for options', since Live Activities don't support notification-style long-press menus. 3. Habit notifications gain 'Not Today' (dismiss only, intentional no-op -- the lifetime-tally philosophy has no concept of a logged miss) and 'Stop Tracking' (destructive-styled; flips the habit's master toggle off and cancels every pending notification for that type across all its slots). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
969 B
Swift
27 lines
969 B
Swift
import AppIntents
|
|
import ActivityKit
|
|
|
|
/// Ends a running task Live Activity directly from its Lock Screen / Dynamic
|
|
/// Island card — no need to open the app. Runs in the widget extension
|
|
/// process (that's how LiveActivityIntent works), so it talks to ActivityKit
|
|
/// directly rather than going through LiveActivityManager (app target only).
|
|
@available(iOS 17.0, *)
|
|
struct StopCountdownIntent: LiveActivityIntent {
|
|
static var title: LocalizedStringResource = "Stop Countdown"
|
|
static var description = IntentDescription("Ends this task's live countdown.")
|
|
|
|
@Parameter(title: "Task ID")
|
|
var taskID: String
|
|
|
|
init() {}
|
|
init(taskID: String) { self.taskID = taskID }
|
|
|
|
func perform() async throws -> some IntentResult {
|
|
for activity in Activity<TaskActivityAttributes>.activities
|
|
where activity.attributes.taskID == taskID {
|
|
await activity.end(dismissalPolicy: .immediate)
|
|
}
|
|
return .result()
|
|
}
|
|
}
|