Skip to content

Commit

Permalink
Fix resume playback (Closes #143)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmuslos committed Oct 2, 2024
1 parent 47517e3 commit a8bfc7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Multiplatform/Intents/IntentDonator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ShelfPlayerKit
import SPPlayback

internal final class IntentDonator {
var lastDonatedItem: Item?
internal var lastDonatedItem: Item?

init() {
lastDonatedItem = nil
Expand Down
3 changes: 2 additions & 1 deletion Multiplatform/Intents/PlayMediaIntentHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ internal extension PlayMediaIntentHandler {
}

func resolveResumePlayback(for intent: INPlayMediaIntent) async -> INBooleanResolutionResult {
.success(with: intent.resumePlayback ?? true)
return .success(with: true)
}

func resolvePlaybackRepeatMode(for intent: INPlayMediaIntent) async -> INPlaybackRepeatModeResolutionResult {
Expand Down Expand Up @@ -170,6 +170,7 @@ internal extension PlayMediaIntentHandler {
AudioPlayer.shared.queue(item)
} else {
do {
IntentDonator.shared.lastDonatedItem = item
try await AudioPlayer.shared.play(item, at: resumePlayback ? nil : 0, withoutPlaybackSession: offline)
} catch {
return .init(code: .failure, userActivity: nil)
Expand Down

0 comments on commit a8bfc7b

Please sign in to comment.