Skip to content

Commit

Permalink
fix: convert items to dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
Pashkagreen committed Jan 23, 2024
1 parent b34c559 commit 69d669e
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions ios/MusicModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,6 @@ class MusicModule: RCTEventEmitter {
func setPlaybackQueue(_ itemId: String, type: String, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
Task {
do {
print(itemId, type)

let musicItemId = MusicItemID.init(itemId)

if let requestType = MediaType.getRequest(forType: type, musicItemId: musicItemId) {
Expand All @@ -451,15 +449,13 @@ class MusicModule: RCTEventEmitter {

guard let tracksToBeAdded = response.items.first else { return }

print("\(type) to be set in queue: \(tracksToBeAdded)")

let player = SystemMusicPlayer.shared

player.queue = [tracksToBeAdded] /// <- directly add items to the queue

try await player.prepareToPlay()

resolve(["Track(s) are added to queue"])
resolve("Track(s) are added to queue")

return

Expand All @@ -469,15 +465,13 @@ class MusicModule: RCTEventEmitter {

guard let tracksToBeAdded = response.items.first else { return }

print("\(type) to be set in queue: \(tracksToBeAdded)")

let player = SystemMusicPlayer.shared

player.queue = [tracksToBeAdded] /// <- directly add items to the queue

try await player.prepareToPlay()

resolve(["Album is added to queue"])
resolve("Album is added to queue")

return

Expand All @@ -487,15 +481,13 @@ class MusicModule: RCTEventEmitter {

guard let tracksToBeAdded = response.items.first else { return }

print("\(type) to be set in queue: \(tracksToBeAdded)")

let player = SystemMusicPlayer.shared

player.queue = [tracksToBeAdded] /// <- directly add items to the queue

try await player.prepareToPlay()

resolve(["Playlist is added to queue"])
resolve("Playlist is added to queue")

return

Expand All @@ -505,15 +497,13 @@ class MusicModule: RCTEventEmitter {

guard let tracksToBeAdded = response.items.first else { return }

print("\(type) to be set in queue: \(tracksToBeAdded)")

let player = SystemMusicPlayer.shared

player.queue = [tracksToBeAdded] /// <- directly add items to the queue

try await player.prepareToPlay()

resolve(["Station is added to queue"])
resolve("Station is added to queue")

return

Expand Down

0 comments on commit 69d669e

Please sign in to comment.