Skip to content

Commit

Permalink
AND-19285 Support Kotlin 2.0 (T17320522)
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelgc6 committed Aug 19, 2024
1 parent 25520d3 commit 055973f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,8 @@ private fun ParticipantsFullListView(
val scaffoldState = rememberScaffoldState()
val snackbarHostState = remember { SnackbarHostState() }
val coroutineScope = rememberCoroutineScope()
val modalSheetState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
confirmValueChange = { it != ModalBottomSheetValue.HalfExpanded },
skipHalfExpanded = true,
)
val modalSheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)

var isAdmitAllButtonEnabled by rememberSaveable { mutableStateOf(true) }
var isCallUserLimitWarningShown by rememberSaveable { mutableStateOf(false) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,7 @@ fun RecurringMeetingInfoView(
val scaffoldState = rememberScaffoldState()
val snackbarHostState = remember { SnackbarHostState() }
val coroutineScope = rememberCoroutineScope()
val modalSheetState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
confirmValueChange = { it != ModalBottomSheetValue.HalfExpanded },
skipHalfExpanded = true,
)
val modalSheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)

BackHandler(enabled = modalSheetState.isVisible) {
coroutineScope.launch { modalSheetState.hide() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ internal fun QRCodeView(
var showScannedContactLinkResult by remember { mutableStateOf<ScannedContactLinkResult?>(null) }
var showInviteContactResult by remember { mutableStateOf<InviteContactRequest?>(null) }
var qrCodeComposableBounds by remember { mutableStateOf<Rect?>(null) }

val modalSheetState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
confirmValueChange = { it != ModalBottomSheetValue.HalfExpanded },
skipHalfExpanded = true,
)
val modalSheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)

BackHandler(enabled = modalSheetState.isVisible) {
coroutineScope.launch { modalSheetState.hide() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,7 @@ internal fun TestPasswordComposeView(
}
) { padding ->
val coroutineScope = rememberCoroutineScope()
val modalSheetState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
confirmStateChange = { it != ModalBottomSheetValue.HalfExpanded },
skipHalfExpanded = true,
)
val modalSheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)

BackHandler(enabled = modalSheetState.isVisible) {
coroutineScope.launch { modalSheetState.hide() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.ModalBottomSheetState
import androidx.compose.material.ModalBottomSheetValue
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.test.onNodeWithTag
import mega.privacy.android.app.presentation.meeting.view.sheet.CANCEL_OCCURRENCE_TAG
import mega.privacy.android.app.presentation.meeting.view.sheet.RecurringMeetingOccurrenceBottomSheetView
Expand All @@ -28,11 +29,6 @@ class RecurringMeetingOccurrenceBottomSheetViewTest {
private val parentSchedId = 123456L
private val schedId = 789123L

private val sheetState = ModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
isSkipHalfExpanded = false,
)

@Test
fun `test that Cancel button is shown`() {
initComposeRuleContent(
Expand Down Expand Up @@ -91,6 +87,12 @@ class RecurringMeetingOccurrenceBottomSheetViewTest {
onEditClick: () -> Unit,
) {
composeTestRule.setContent {
val sheetState = ModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
isSkipHalfExpanded = false,
density = LocalDensity.current,
)

val coroutineScope = rememberCoroutineScope()

RecurringMeetingOccurrenceBottomSheetView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotDisplayed
Expand All @@ -34,11 +35,14 @@ class BottomSheetTest {
fun `test that when view is set bottom sheet is not displayed to the user`() {
val message = "message to test"
val button = "show-bottom-sheet"
val sheetState = ModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
isSkipHalfExpanded = false,
)

composeTestRule.setContent {
val sheetState = ModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
isSkipHalfExpanded = false,
density = LocalDensity.current,
)

val coroutineScope = rememberCoroutineScope()
BottomSheet(
modalSheetState = sheetState,
Expand Down Expand Up @@ -74,11 +78,14 @@ class BottomSheetTest {
fun `test that when user clicks on button to show bottom sheet bottom sheet is shown to user`() {
val message = "message to test"
val button = "show-bottom-sheet"
val sheetState = ModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
isSkipHalfExpanded = false,
)

composeTestRule.setContent {
val sheetState = ModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
isSkipHalfExpanded = false,
density = LocalDensity.current
)

val coroutineScope = rememberCoroutineScope()
BottomSheet(
modalSheetState = sheetState,
Expand Down

0 comments on commit 055973f

Please sign in to comment.