diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceFragment.kt index cc04211228..2000f71df5 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceFragment.kt @@ -57,6 +57,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.D1 import io.horizontalsystems.bankwallet.ui.compose.components.HeaderText import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton import io.horizontalsystems.bankwallet.ui.compose.components.HsSwitch +import io.horizontalsystems.bankwallet.ui.compose.components.InfoText import io.horizontalsystems.bankwallet.ui.compose.components.MultitextM1 import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantWarning @@ -159,7 +160,7 @@ fun AppearanceScreen(navController: NavController) { HeaderText(text = stringResource(id = R.string.Appearance_Tab)) CellUniversalLawrenceSection( - listOf({ + listOf { RowUniversal( modifier = Modifier.padding(horizontal = 16.dp), ) { @@ -171,21 +172,26 @@ fun AppearanceScreen(navController: NavController) { ) body_leah( - text = stringResource(id = R.string.Appearance_MarketsTab), + text = stringResource(id = R.string.Appearance_HideMarketsTab), modifier = Modifier .weight(1f) .padding(horizontal = 16.dp) ) HsSwitch( - checked = uiState.marketsTabEnabled, + checked = uiState.marketsTabHidden, onCheckedChange = { - viewModel.onSetMarketTabsEnabled(it) + viewModel.onSetMarketTabsHidden(it) } ) - } - }, { + } + ) + Spacer(modifier = Modifier.height(24.dp)) + + HeaderText(text = stringResource(id = R.string.Appearance_BalanceTab)) + CellUniversalLawrenceSection( + listOf { RowUniversal( modifier = Modifier.padding(horizontal = 16.dp), ) { @@ -197,25 +203,27 @@ fun AppearanceScreen(navController: NavController) { ) body_leah( - text = stringResource(id = R.string.Appearance_BalanceTabButtons), + text = stringResource(id = R.string.Appearance_HideBalanceTabButtons), modifier = Modifier .weight(1f) .padding(horizontal = 16.dp) ) HsSwitch( - checked = uiState.balanceTabButtonsEnabled, + checked = uiState.balanceTabButtonsHidden, onCheckedChange = { - viewModel.onSetBalanceTabButtons(it) + viewModel.onSetBalanceTabButtonsHidden(it) } ) - } - }) + } + ) + InfoText( + text = stringResource(R.string.Appearance_HideBalanceTabButtonsDescription), + paddingBottom = 24.dp ) - Spacer(modifier = Modifier.height(24.dp)) - AnimatedVisibility(visible = uiState.marketsTabEnabled) { + AnimatedVisibility(visible = !uiState.marketsTabHidden) { Column { HeaderText(text = stringResource(id = R.string.Appearance_LaunchScreen)) CellUniversalLawrenceSection(uiState.launchScreenOptions.options) { option -> diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceViewModel.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceViewModel.kt index a3b9e0db68..0dd24188ab 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceViewModel.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceViewModel.kt @@ -32,8 +32,8 @@ class AppearanceViewModel( private var appIconOptions = appIconService.optionsFlow.value private var themeOptions = themeService.optionsFlow.value private var baseTokenOptions = buildBaseTokenSelect(baseTokenManager.baseTokenFlow.value) - private var marketsTabEnabled = localStorage.marketsTabEnabled - private var balanceTabButtonsEnabled = localStorage.balanceTabButtonsEnabled + private var marketsTabHidden = !localStorage.marketsTabEnabled + private var balanceTabButtonsHidden = !localStorage.balanceTabButtonsEnabled private var balanceViewTypeOptions = buildBalanceViewTypeSelect(balanceViewTypeManager.balanceViewTypeFlow.value) private val currentLanguageDisplayName: String @@ -86,10 +86,10 @@ class AppearanceViewModel( themeOptions = themeOptions, baseTokenOptions = baseTokenOptions, balanceViewTypeOptions = balanceViewTypeOptions, - marketsTabEnabled = marketsTabEnabled, + marketsTabHidden = marketsTabHidden, currentLanguage = currentLanguageDisplayName, baseCurrencyCode = baseCurrencyCode, - balanceTabButtonsEnabled = balanceTabButtonsEnabled + balanceTabButtonsHidden = balanceTabButtonsHidden ) private fun buildBaseTokenSelect(token: Token?): SelectOptional { @@ -145,20 +145,20 @@ class AppearanceViewModel( balanceViewTypeManager.setViewType(viewType) } - fun onSetMarketTabsEnabled(enabled: Boolean) { - if (enabled.not() && (launchScreenOptions.selected == LaunchPage.Market || launchScreenOptions.selected == LaunchPage.Watchlist)) { + fun onSetMarketTabsHidden(hidden: Boolean) { + if (hidden && (launchScreenOptions.selected == LaunchPage.Market || launchScreenOptions.selected == LaunchPage.Watchlist)) { launchScreenService.setLaunchScreen(LaunchPage.Auto) } - localStorage.marketsTabEnabled = enabled + localStorage.marketsTabEnabled = !hidden - marketsTabEnabled = enabled + marketsTabHidden = hidden emitState() } - fun onSetBalanceTabButtons(enabled: Boolean) { - localStorage.balanceTabButtonsEnabled = enabled + fun onSetBalanceTabButtonsHidden(hidden: Boolean) { + localStorage.balanceTabButtonsEnabled = !hidden - balanceTabButtonsEnabled = enabled + balanceTabButtonsHidden = hidden emitState() } @@ -170,8 +170,8 @@ data class AppearanceUIState( val themeOptions: Select, val baseTokenOptions: SelectOptional, val balanceViewTypeOptions: Select, - val marketsTabEnabled: Boolean, + val marketsTabHidden: Boolean, val currentLanguage: String, val baseCurrencyCode: String, - val balanceTabButtonsEnabled: Boolean, + val balanceTabButtonsHidden: Boolean, ) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0beb024a31..be8b1b6198 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -983,13 +983,15 @@ THEME TAB SETTINGS + BALANCE TAB LAUNCH SCREEN APP ICON BALANCE CONVERSION BALANCE VALUE Changing icon will close application - Markets Tab - Balance Tab Buttons + Hide Markets + Hide Buttons + This configuration hides the Send, Receive, and Swap buttons on Balance tab. Balance Auto Hide Automatically hides balance each time the app is opened, regardless of previous preferences.