Two structural fixes after diffing against the package's working example:
- Revert ContentState to empty. The plugin's createActivity calls a
ContentState() constructor with no args from the example pattern; the
appGroupId field was a red herring from the plugin's internal type.
- Switch the widget's @available marker from iOS 16.1 to
iOSApplicationExtension 16.1, the correct platform key for an app
extension target. iOS 16.1 was being honored at compile time but the
WidgetKit registration uses the extension-specific availability scope.
- Inline the field reads inside the widget closures (matches the example
layout) instead of routing through a helper struct.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The plugin's internal LiveActivitiesAppAttributes.ContentState declares
'var appGroupId: String' and constructs Activity requests with that
field populated. Our widget declared an empty ContentState, so ActivityKit
rejected every launch with ActivityInput error 0 (malformedAttributes).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The package always launches Activity<LiveActivitiesAppAttributes> internally
and writes payload fields to the App Group's UserDefaults keyed by
"<id>_<fieldName>". Our custom TrainerActivityAttributes was never matched
by the system (ActivityInput error 0).
- Replace TrainerActivityAttributes with the package-required
LiveActivitiesAppAttributes (empty ContentState + UUID id + prefixedKey
helper extension).
- Rewrite TrainerActivity widget to read all fields from
UserDefaults(suiteName: "group.de.jonasbark.swiftcontrol.overlay") via
attributes.prefixedKey(...).
- Wrap the widget in a WidgetBundle gated on iOS 16.1 so the @main entry
point compiles on older deployment targets too.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds all source files for the TrainerActivity WidgetKit extension:
TrainerActivity.swift (@main, Lock Screen banner + Dynamic Island views),
TrainerActivityAttributes.swift (ActivityAttributes struct with gear,
mode, power, cadence, and erg-target fields), Info.plist, and
TrainerActivity.entitlements (App Group group.de.jonasbark.swiftcontrol.overlay).
A README documents the one-time manual Xcode steps required to wire the
target before flutter build ios will succeed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>