mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-29 21:02:09 +02:00
Publish artwork, metadata, and transport state through a shared Dart bridge. Add configurable Android RemoteViews and iOS WidgetKit players with controls and links into the full player. Serialize widget commands and session restoration, and share one headless-capable iOS Flutter engine with the foreground scene. Include native integration tests, Dart bridge tests, and widget setup documentation.
20 lines
543 B
Swift
20 lines
543 B
Swift
import AppIntents
|
|
|
|
@available(iOS 17.0, *)
|
|
struct PlayerControlIntent: AudioPlaybackIntent {
|
|
static var title: LocalizedStringResource = "Control music playback"
|
|
static var openAppWhenRun = false
|
|
|
|
@Parameter(title: "Action") var action: String
|
|
|
|
init() { action = "toggle" }
|
|
init(_ action: String) { self.action = action }
|
|
|
|
func perform() async throws -> some IntentResult {
|
|
#if !PLAYER_WIDGET_EXTENSION
|
|
_ = await PlayerWidgetBridge.shared.perform(action)
|
|
#endif
|
|
return .result()
|
|
}
|
|
}
|