Skip to content

Commit

Permalink
Update server
Browse files Browse the repository at this point in the history
  • Loading branch information
toasterofbread committed Mar 5, 2024
1 parent e4bf320 commit f0f4c21
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ internal fun SpMsPlayerService.applyPlayerEvent(event: SpMsPlayerEvent) {
it.onEvents()
}
}
else -> throw NotImplementedError(event.toString())
SpMsPlayerEvent.Type.CLEARED -> {
for (i in playlist.indices.reversed()) {
playlist.removeAt(i)
listeners.forEach {
it.onSongRemoved(i)
}
}
listeners.forEach {
it.onEvents()
}
}

SpMsPlayerEvent.Type.READY_TO_PLAY -> {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ internal suspend fun SpMsPlayerService.applyServerState(
it.onEvents()
}
}
if (state.volume != _volume) {
_volume = state.volume
listeners.forEach {
it.onVolumeChanged(_volume)
it.onEvents()
}
}
if (state.repeat_mode != _repeat_mode) {
_repeat_mode = state.repeat_mode
listeners.forEach {
Expand Down

0 comments on commit f0f4c21

Please # to comment.