Files
SpotiFLAC-Mobile/ios/PlayerWidget/PlayerControlIntent.swift
T
zarzet 040c328479 feat(widgets): add native Android and iOS home screen players
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.
2026-09-25 01:22:58 +07:00

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()
}
}