Split the two large widget files (~2000 lines combined) into 10 focused files: - WidgetBundle.swift: Main @main bundle registration - WidgetModels.swift: Shared data models (WatchTimelineView, SimpleEntry, etc.) - WidgetProviders.swift: Timeline providers and TimeLineCreator - WidgetSharedViews.swift: Shared voting views - FeelsTimelineWidget.swift: Timeline widget (small/medium/large) - FeelsVoteWidget.swift: Vote widget with stats views - FeelsIconWidget.swift: Custom icon widget - FeelsGraphicWidget.swift: Graphic mood widget - FeelsMoodControlWidget.swift: Control Center widget - FeelsLiveActivity.swift: Live Activity with proper previews Preserves real-time update architecture (VoteMoodIntent, WidgetCenter, WidgetDataProvider patterns). Adds proper Live Activity preview support with sample content states. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
37 lines
936 B
Swift
37 lines
936 B
Swift
//
|
|
// FeelsMoodControlWidget.swift
|
|
// FeelsWidget
|
|
//
|
|
// Control Center widget for quick mood logging
|
|
//
|
|
|
|
import WidgetKit
|
|
import SwiftUI
|
|
import AppIntents
|
|
|
|
// MARK: - Control Center Widget
|
|
|
|
struct FeelsMoodControlWidget: ControlWidget {
|
|
var body: some ControlWidgetConfiguration {
|
|
StaticControlConfiguration(kind: "FeelsMoodControl") {
|
|
ControlWidgetButton(action: OpenFeelsIntent()) {
|
|
Label("Log Mood", systemImage: "face.smiling")
|
|
}
|
|
}
|
|
.displayName("Log Mood")
|
|
.description("Open Feels to log your mood")
|
|
}
|
|
}
|
|
|
|
// MARK: - Open App Intent
|
|
|
|
struct OpenFeelsIntent: AppIntent {
|
|
static var title: LocalizedStringResource = "Open Feels"
|
|
static var description = IntentDescription("Open the Feels app to log your mood")
|
|
static var openAppWhenRun: Bool = true
|
|
|
|
func perform() async throws -> some IntentResult {
|
|
return .result()
|
|
}
|
|
}
|