Skip to content

Commit

Permalink
fix: requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pashkagreen committed Jan 20, 2024
1 parent efd0f54 commit 750a81b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ios/MusicModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MusicModule: RCTEventEmitter {

private func sendPlaybackStateUpdate() {
let state = SystemMusicPlayer.shared.state
let playbackInterval = SystemMusicPlayer.shared.playbackTime
let playbackTime = SystemMusicPlayer.shared.playbackTime
let playbackStatusDescription = describePlaybackStatus(state.playbackStatus)
let playbackRate = state.playbackRate

Expand All @@ -59,7 +59,7 @@ class MusicModule: RCTEventEmitter {
var playbackInfo: [String: Any] = [
"playbackRate": playbackRate,
"playbackStatus": playbackStatusDescription,
"playbackTime": playbackInterval
"playbackTime": playbackTime
]

if let songInfo = songInfo {
Expand All @@ -76,13 +76,15 @@ class MusicModule: RCTEventEmitter {
@objc(getCurrentState:)
func getCurrentState(_ callback: @escaping RCTResponseSenderBlock) {
let state = SystemMusicPlayer.shared.state
let playbackTime = SystemMusicPlayer.shared.playbackTime
let playbackStatusDescription = describePlaybackStatus(state.playbackStatus)
let playbackRate = state.playbackRate

self.getCurrentSongInfo { songInfo in
var currentState: [String: Any] = [
"playbackRate": playbackRate,
"playbackStatus": playbackStatusDescription
"playbackStatus": playbackStatusDescription,
"playbackTime": playbackTime
]

if let songInfo = songInfo {
Expand All @@ -102,10 +104,6 @@ class MusicModule: RCTEventEmitter {

switch currentEntry.item {
case .song(let song):
print("Current song: \(song.title) - \(song.artistName)")
print("Current song ID: \(String(describing: song.id))")
print("Current song duration: \(song.duration ?? 0)")

Task {
let songID = song.id
let request = MusicCatalogResourceRequest<Song>(matching: \.id, equalTo: songID)
Expand Down

0 comments on commit 750a81b

Please sign in to comment.