Skip to content

Commit 95936da

Browse files
committed
fix(player-ui): fix crashes when player error snackbar is toggled
1 parent 322bd72 commit 95936da

File tree

1 file changed

+7
-1
lines changed
  • feature/mobile/player/src/main/java/com/flixclusive/feature/mobile/player

1 file changed

+7
-1
lines changed

feature/mobile/player/src/main/java/com/flixclusive/feature/mobile/player/PlayerScreen.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import com.flixclusive.core.ui.mobile.rememberPipMode
5151
import com.flixclusive.core.ui.mobile.util.toggleSystemBars
5252
import com.flixclusive.core.ui.player.PLAYER_CONTROL_VISIBILITY_TIMEOUT
5353
import com.flixclusive.core.ui.player.PlayerScreenNavArgs
54+
import com.flixclusive.core.ui.player.PlayerSnackbarMessageType
5455
import com.flixclusive.core.ui.player.util.ACTION_PIP_CONTROL
5556
import com.flixclusive.core.ui.player.util.PLAYER_PIP_EVENT
5657
import com.flixclusive.core.ui.player.util.PlayerUiUtil.AudioFocusManager
@@ -78,6 +79,7 @@ import kotlinx.coroutines.async
7879
import kotlinx.coroutines.delay
7980
import kotlinx.coroutines.launch
8081
import kotlin.math.roundToInt
82+
import kotlin.random.Random
8183

8284
interface PlayerScreenNavigator : GoBackAction {
8385
/**
@@ -512,7 +514,11 @@ fun PlayerScreen(
512514
) {
513515
items(
514516
items = viewModel.snackbarQueue,
515-
key = { data -> data.type }
517+
key = { data ->
518+
if (data.type == PlayerSnackbarMessageType.Error) {
519+
data.type.ordinal + Random.nextInt()
520+
} else data.type.ordinal
521+
}
516522
) { data ->
517523
PlayerSnackbar(
518524
messageData = data,

0 commit comments

Comments
 (0)