Skip to content

Commit

Permalink
Code naming fix: isShow to isShown (#4044)
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterBin authored Jan 9, 2025
1 parent 9ae0d4e commit da2c2ac
Show file tree
Hide file tree
Showing 49 changed files with 68 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal class MainScreenStateHolder(private val intents: MainIntents) {
stateFlowInternal.update { state ->
state.copy(
modalNotification = TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = intents::onDismissBottomSheet,
content = notificationsFactory.createBalancesAreHiddenModalNotification(),
),
Expand All @@ -45,7 +45,7 @@ internal class MainScreenStateHolder(private val intents: MainIntents) {

fun updateWithoutModalNotification() {
stateFlowInternal.update { state ->
state.copy(modalNotification = state.modalNotification?.copy(isShow = false))
state.copy(modalNotification = state.modalNotification?.copy(isShown = false))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ internal class MainViewModel @Inject constructor(
it.isBalanceHidingNotificationEnabled && it.isBalanceHidden
}
.onEach {
if (state.value.modalNotification?.isShow != true && !it.isUpdateFromToast) {
if (state.value.modalNotification?.isShown != true && !it.isUpdateFromToast) {
listenToFlipsUseCase.changeUpdateEnabled(false)
stateHolder.updateWithHiddenBalancesNotification()
router.push(AppRoute.ModalNotification)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal class ModalNotificationBottomSheetFragment : ComposeBottomSheetFragment
}

LaunchedEffect(notification) {
if (!notification.isShow) {
if (!notification.isShown) {
dismiss()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private fun Preview_GiveTxPermissionBottomSheet() {
TangemThemePreview {
GiveTxPermissionBottomSheet(
config = TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = {},
content = previewData,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.tangem.core.ui.components.bottomsheets

import androidx.activity.compose.BackHandler
import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.compose.foundation.background
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
Expand Down Expand Up @@ -99,7 +98,7 @@ inline fun <reified T : TangemBottomSheetConfigContent> DefaultBottomSheet(
crossinline title: @Composable (BoxScope.(T) -> Unit),
crossinline content: @Composable (ColumnScope.(T) -> Unit),
) {
var isVisible by remember { mutableStateOf(value = config.isShow) }
var isVisible by remember { mutableStateOf(value = config.isShown) }
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = skipPartiallyExpanded)

if (isVisible && config.content is T) {
Expand All @@ -114,8 +113,8 @@ inline fun <reified T : TangemBottomSheetConfigContent> DefaultBottomSheet(
)
}

LaunchedEffect(key1 = config.isShow) {
if (config.isShow) {
LaunchedEffect(key1 = config.isShown) {
if (config.isShown) {
isVisible = true
} else {
sheetState.collapse { isVisible = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.tangem.core.ui.components.bottomsheets
/**
* Tangem bottom sheet config
*
* @property isShow flag that determine if bottom sheet is shown
* @property isShown flag that determine if bottom sheet is shown
* @property onDismissRequest lambda be invoked when bottom sheet is dismissed
* @property content content config
*/
data class TangemBottomSheetConfig(
val isShow: Boolean,
val isShown: Boolean,
val onDismissRequest: () -> Unit,
val content: TangemBottomSheetConfigContent,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private fun Preview_NotificationBottomSheet(
MessageBottomSheet(
config = TangemBottomSheetConfig(
content = params,
isShow = true,
isShown = true,
onDismissRequest = {},
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private fun Preview_TokenReceiveBottomSheet(
) {
TangemThemePreview {
val config = TangemBottomSheetConfig(
isShow = true,
isShown = true,
content = params,
onDismissRequest = {},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fun EventMessageEffect(
@Composable
private fun MessageBottomSheet(message: BottomSheetMessage, onDismissRequest: () -> Unit) {
val config = TangemBottomSheetConfig(
isShow = true,
isShown = true,
content = MessageBottomSheetUM(
iconResId = message.iconResId,
title = message.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal class DefaultAddCustomTokenComponent @AssistedInject constructor(
override fun BottomSheet() {
val config = remember {
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = ::dismiss,
content = initialConfiguration.step.toContentModel(::popBack),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal class PreviewAddCustomTokenComponent(
override fun BottomSheet() {
val config by previewConfig.collectAsStateWithLifecycle()
val bottomSheetConfig = TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = ::dismiss,
content = config.step.toContentModel(::dismiss),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ internal class MarketsTokenDetailsModel @Inject constructor(
body = MarketsTokenDetailsUM.Body.Loading,
triggerPriceChange = consumedEvent(),
bottomSheetConfig = TangemBottomSheetConfig(
isShow = false,
isShown = false,
onDismissRequest = {},
content = TangemBottomSheetConfigContent.Empty,
),
Expand Down Expand Up @@ -510,7 +510,7 @@ internal class MarketsTokenDetailsModel @Inject constructor(
state.update { stateToUpdate ->
stateToUpdate.copy(
bottomSheetConfig = stateToUpdate.bottomSheetConfig.copy(
isShow = true,
isShown = true,
onDismissRequest = ::hideBottomSheet,
content = content,
),
Expand All @@ -521,7 +521,7 @@ internal class MarketsTokenDetailsModel @Inject constructor(
private fun hideBottomSheet() {
state.update { stateToUpdate ->
stateToUpdate.copy(
bottomSheetConfig = stateToUpdate.bottomSheetConfig.copy(isShow = false),
bottomSheetConfig = stateToUpdate.bottomSheetConfig.copy(isShown = false),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ private fun Preview() {
onSelectedIntervalChange = { },
body = MarketsTokenDetailsUM.Body.Loading,
bottomSheetConfig = TangemBottomSheetConfig(
isShow = false,
isShown = false,
onDismissRequest = {},
content = TangemBottomSheetConfigContent.Empty,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private fun Preview_ExchangesBottomSheet(
config = TangemBottomSheetConfig(
onDismissRequest = {},
content = content,
isShow = true,
isShown = true,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private fun SecurityScoreBottomSheetPreview() {
TangemThemePreview {
SecurityScoreBottomSheet(
config = TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = {},
content = SecurityScorePreviewData.bottomSheetContent,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal class AddToPortfolioBSContentUMFactory(
alreadyAddedNetworks: Set<String>?,
): TangemBottomSheetConfig {
return TangemBottomSheetConfig(
isShow = portfolioUIData.portfolioBSVisibilityModel.addToPortfolioBSVisibility,
isShown = portfolioUIData.portfolioBSVisibilityModel.addToPortfolioBSVisibility,
onDismissRequest = { onAddToPortfolioVisibilityChange(false) },
content = if (selectedWallet != null && alreadyAddedNetworks != null) {
AddToPortfolioBSContentUM(
Expand Down Expand Up @@ -107,7 +107,7 @@ internal class AddToPortfolioBSContentUMFactory(
selectedWalletId: UserWalletId,
): TangemBottomSheetConfig {
return TangemBottomSheetConfig(
isShow = isShow,
isShown = isShow,
onDismissRequest = { onWalletSelectorVisibilityChange(false) },
content = WalletSelectorBSContentUM(
userWallets = portfolioData.walletsWithCurrencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ internal class TokenActionsHandler @AssistedInject constructor(

updateTokenReceiveBSConfig {
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = {
updateTokenReceiveBSConfig {
it.copy(isShow = false)
it.copy(isShown = false)
}
},
content = TokenReceiveBottomSheetConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private fun Preview(
TangemThemePreview {
AddToPortfolioBottomSheet(
config = TangemBottomSheetConfig(
isShow = true,
isShown = true,
content = content,
onDismissRequest = {},
),
Expand Down Expand Up @@ -370,7 +370,7 @@ private fun PreviewContentTestOnDevice(

AddToPortfolioBottomSheet(
config = TangemBottomSheetConfig(
isShow = isShow,
isShown = isShow,
content = contentState,
onDismissRequest = { isShow = false },
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private fun Preview() {
Box(Modifier.background(TangemTheme.colors.background.secondary)) {
TokenActionsBottomSheet(
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = {},
content = TokenActionsBSContentUM(
title = "Wallet 1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private fun Preview() {
TangemThemePreview {
WalletSelectorBottomSheet(
config = TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = {},
content = WalletSelectorBSContentUM(
userWallets = persistentListOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ internal class MarketsListUMStateManager(
) {

private var sortByBottomSheetIsShown
get() = state.value.sortByBottomSheet.isShow
set(value) = state.update { it.copy(sortByBottomSheet = it.sortByBottomSheet.copy(isShow = value)) }
get() = state.value.sortByBottomSheet.isShown
set(value) = state.update { it.copy(sortByBottomSheet = it.sortByBottomSheet.copy(isShown = value)) }

var searchQuery
get() = state.value.searchBar.query
Expand Down Expand Up @@ -203,7 +203,7 @@ internal class MarketsListUMStateManager(
onIntervalClick = { selectedInterval = it },
onSortByButtonClick = { sortByBottomSheetIsShown = true },
sortByBottomSheet = TangemBottomSheetConfig(
isShow = false,
isShown = false,
onDismissRequest = { sortByBottomSheetIsShown = false },
content = SortByBottomSheetContentUM(
selectedOption = SortByTypeUM.Rating,
Expand All @@ -217,7 +217,7 @@ internal class MarketsListUMStateManager(
it.copy(
selectedSortBy = sortByTypeUM,
sortByBottomSheet = it.sortByBottomSheet.copy(
isShow = false,
isShown = false,
content = (it.sortByBottomSheet.content as SortByBottomSheetContentUM).copy(
selectedOption = sortByTypeUM,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal fun MarketsList(
)
MarketsListSortByBottomSheet(config = state.sortByBottomSheet)
KeyboardEvents(
isSortByBottomSheetShown = state.sortByBottomSheet.isShow,
isSortByBottomSheetShown = state.sortByBottomSheet.isShown,
bottomSheetState = bottomSheetState,
)
}
Expand Down Expand Up @@ -321,7 +321,7 @@ private fun Preview() {
onIntervalClick = {},
onSortByButtonClick = {},
sortByBottomSheet = TangemBottomSheetConfig(
isShow = false,
isShown = false,
onDismissRequest = {},
content = SortByBottomSheetContentUM(selectedOption = SortByTypeUM.Rating) {},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private fun Preview() {
Box(Modifier.background(TangemTheme.colors.background.secondary)) {
MarketsListSortByBottomSheet(
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = {},
content = SortByBottomSheetContentUM(
selectedOption = SortByTypeUM.Trending,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MultiWalletAccessCodeComponent(

val bsConfig = remember(this, showBs) {
TangemBottomSheetConfig(
isShow = showBs,
isShown = showBs,
onDismissRequest = { dismiss() },
content = TangemBottomSheetConfigContent.Empty,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ internal class ImportSeedPhraseUiStateBuilder(
updateUiState { state ->
state.copy(
infoBottomSheetConfig = TangemBottomSheetConfig.Empty.copy(
isShow = true,
isShown = true,
onDismissRequest = {
updateUiState { it.copy(infoBottomSheetConfig = TangemBottomSheetConfig.Empty) }
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ImportSeedPhraseStateBuilder {
return uiState.copy(
importSeedPhraseState = uiState.importSeedPhraseState.copy(
bottomSheetConfig = TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = onDismiss,
content = ShowPassphraseInfoBottomSheetContent(onDismiss),
),
Expand All @@ -81,7 +81,7 @@ class ImportSeedPhraseStateBuilder {
return uiState.copy(
importSeedPhraseState = uiState.importSeedPhraseState.copy(
bottomSheetConfig = uiState.importSeedPhraseState.bottomSheetConfig?.copy(
isShow = false,
isShown = false,
),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class DefaultConfirmResidencyComponent @AssistedInject constructor(
val bottomSheet by bottomSheetSlot.subscribeAsState()
val bottomSheetConfig = remember(key1 = this) {
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = ::dismiss,
content = TangemBottomSheetConfigContent.Empty,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class PreviewConfirmResidencyComponent(
val state by previewState.collectAsStateWithLifecycle()
val bottomSheetConfig = remember(key1 = this) {
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = ::dismiss,
content = TangemBottomSheetConfigContent.Empty,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class DefaultSelectPaymentMethodComponent @AssistedInject constructor(
override fun BottomSheet() {
val bottomSheetConfig = remember(key1 = this) {
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = ::dismiss,
content = PaymentMethodsBottomSheetConfig(
selectedMethodId = params.selectedMethodId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal class DefaultSelectProviderComponent @AssistedInject constructor(

val bottomSheetConfig = remember(key1 = this) {
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = ::dismiss,
content = TangemBottomSheetConfigContent.Empty,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class DefaultSelectCountryComponent @AssistedInject constructor(
val state by model.state.collectAsStateWithLifecycle()
val bottomSheetConfig = remember(key1 = this) {
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = ::dismiss,
content = TangemBottomSheetConfigContent.Empty,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class DefaultSelectCurrencyComponent @AssistedInject constructor(
val state by model.state.collectAsStateWithLifecycle()
val bottomSheetConfig = remember(key1 = this) {
TangemBottomSheetConfig(
isShow = true,
isShown = true,
onDismissRequest = ::dismiss,
content = TangemBottomSheetConfigContent.Empty,
)
Expand Down
Loading

0 comments on commit da2c2ac

Please sign in to comment.