Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ”€ :: μž¬μƒλͺ©λ‘ λ‹΄κΈ° μ‹œ μž¬μƒμ€‘μ΄λ˜ 곑이 λ©ˆμΆ”λŠ” 문제 μˆ˜μ • #314

Merged
merged 1 commit into from
Jun 4, 2023

Conversation

youn9k
Copy link
Member

@youn9k youn9k commented Jun 4, 2023

κ°œμš”

#293

μž‘μ—…μ‚¬ν•­

μˆ˜μ • μ „
self.currentSong = self.playList.currentPlaySong λΆ€ν„°μ˜ μ½”λ“œλŠ” ν”Œλ ˆμ΄μ–΄κ°€ λ‹«ν˜€μžˆλŠ” μƒνƒœμ—μ„œ μž¬μƒλͺ©λ‘ λ‹΄κΈ° μ‹œ,
빈 λ―Έλ‹ˆν”Œλ ˆμ΄μ–΄κ°€ μ˜¬λΌμ˜€λŠ” 것을 막기 μœ„ν•΄ μΆ”κ°€ν•œ μ½”λ“œμ˜€μ§€λ§Œ(#282) ν”Œλ ˆμ΄μ–΄μ˜ μƒνƒœμ— λ”°λ₯Έ λΆ„κΈ°μ²˜λ¦¬κ°€ μ•ˆλ˜μ–΄μžˆμ—ˆμŠ΅λ‹ˆλ‹€.

    /// 주어진 곑듀을 μž¬μƒλͺ©λ‘μ— μΆ”κ°€ν•©λ‹ˆλ‹€.
    /// - Parameter duplicateAllowed: μž¬μƒλͺ©λ‘ μΆ”κ°€ μ‹œ 쀑볡 ν—ˆμš© μ—¬λΆ€ (κΈ°λ³Έκ°’: false)
    func appendSongsToPlaylist(_ songs: [SongEntity], duplicateAllowed: Bool = false) {
        let notDuplicatedSongs = songs.compactMap { song in
            return self.playList.uniqueIndex(of:PlayListItem(item: song)) == nil ? PlayListItem(item: song) : nil
        }
        self.playList.append(notDuplicatedSongs)
        
        if self.state == .unstarted {
            self.switchPlayerMode(to: .mini)
        }
        self.currentSong = self.playList.currentPlaySong
        if let currentSong = currentSong {
            self.player.cue(source: .video(id: currentSong.id))
        }
    }

μˆ˜μ • ν›„
if self.state == .unstarted λŒ€μ‹  if PlayerMode == . close 둜 λ°”κΎΈλ©΄ ν”Œλ ˆμ΄μ–΄κ°€ λ‹«ν˜€μžˆμŒμ„ κ΅¬λΆ„ν•˜κΈ° μœ„ν•¨μ΄ λͺ…ν™•ν•΄μ§ˆ 것 같은데 PlayerMode λ₯Ό PlayStateμ—μ„œ κΈ°μ–΅ν•˜κ³  μžˆμ§€ μ•Šκ³ , λ‘œμ§μ— λ¬Έμ œλŠ” μ—†λ‹€κ³  νŒλ‹¨ν•΄ if self.state == .unstarted 둜 μœ μ§€ν–ˆμŠ΅λ‹ˆλ‹€.

    /// 주어진 곑듀을 μž¬μƒλͺ©λ‘μ— μΆ”κ°€ν•©λ‹ˆλ‹€.
    /// - Parameter duplicateAllowed: μž¬μƒλͺ©λ‘ μΆ”κ°€ μ‹œ 쀑볡 ν—ˆμš© μ—¬λΆ€ (κΈ°λ³Έκ°’: false)
    func appendSongsToPlaylist(_ songs: [SongEntity], duplicateAllowed: Bool = false) {
        let notDuplicatedSongs = songs.compactMap { song in
            return self.playList.uniqueIndex(of:PlayListItem(item: song)) == nil ? PlayListItem(item: song) : nil
        }
        self.playList.append(notDuplicatedSongs)
        
        if self.state == .unstarted {
            self.switchPlayerMode(to: .mini)
            self.currentSong = self.playList.currentPlaySong
            if let currentSong = currentSong {
                self.player.cue(source: .video(id: currentSong.id))
            }
        }
    }

Closes #이슈번호

Copy link
Member

@yongbeomkwak yongbeomkwak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고 ν•˜μ…¨μŠ΅λ‹ˆλ‹€

@youn9k youn9k merged commit fbf9328 into develop Jun 4, 2023
@youn9k youn9k deleted the fix/add_playlist branch June 4, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants