Skip to content

Commit

Permalink
fix(player-ui): fix crashes when player error snackbar is toggled
Browse files Browse the repository at this point in the history
  • Loading branch information
rhenwinch committed Jun 25, 2024
1 parent 322bd72 commit 95936da
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import com.flixclusive.core.ui.mobile.rememberPipMode
import com.flixclusive.core.ui.mobile.util.toggleSystemBars
import com.flixclusive.core.ui.player.PLAYER_CONTROL_VISIBILITY_TIMEOUT
import com.flixclusive.core.ui.player.PlayerScreenNavArgs
import com.flixclusive.core.ui.player.PlayerSnackbarMessageType
import com.flixclusive.core.ui.player.util.ACTION_PIP_CONTROL
import com.flixclusive.core.ui.player.util.PLAYER_PIP_EVENT
import com.flixclusive.core.ui.player.util.PlayerUiUtil.AudioFocusManager
Expand Down Expand Up @@ -78,6 +79,7 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.math.roundToInt
import kotlin.random.Random

interface PlayerScreenNavigator : GoBackAction {
/**
Expand Down Expand Up @@ -512,7 +514,11 @@ fun PlayerScreen(
) {
items(
items = viewModel.snackbarQueue,
key = { data -> data.type }
key = { data ->
if (data.type == PlayerSnackbarMessageType.Error) {
data.type.ordinal + Random.nextInt()
} else data.type.ordinal
}
) { data ->
PlayerSnackbar(
messageData = data,
Expand Down

0 comments on commit 95936da

Please sign in to comment.