Skip to content

Commit

Permalink
Add new fields to local backup file
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelekol committed Jun 5, 2024
1 parent 9a3be26 commit 17685cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import io.horizontalsystems.bankwallet.modules.contacts.model.Contact
import io.horizontalsystems.bankwallet.modules.settings.appearance.AppIcon
import io.horizontalsystems.bankwallet.modules.settings.appearance.AppIconService
import io.horizontalsystems.bankwallet.modules.settings.appearance.LaunchScreenService
import io.horizontalsystems.bankwallet.modules.settings.appearance.PriceChangeInterval
import io.horizontalsystems.bankwallet.modules.theme.ThemeService
import io.horizontalsystems.bankwallet.modules.theme.ThemeType
import io.horizontalsystems.core.toHexString
Expand Down Expand Up @@ -225,6 +226,8 @@ class BackupProvider(

launchScreenService.setLaunchScreen(settings.launchScreen)
localStorage.marketsTabEnabled = settings.marketsTabEnabled
localStorage.balanceTabButtonsEnabled = settings.balanceHideButtons ?: false
localStorage.priceChangeInterval = settings.priceChangeMode ?: PriceChangeInterval.LAST_24H
currencyManager.setBaseCurrencyCode(settings.baseCurrency)


Expand Down Expand Up @@ -454,16 +457,18 @@ class BackupProvider(
val settings = Settings(
balanceViewType = balanceViewTypeManager.balanceViewTypeFlow.value,
appIcon = localStorage.appIcon?.titleText ?: AppIcon.Main.titleText,
currentTheme = themeService.optionsFlow.value.selected,
currentTheme = themeService.selectedTheme,
chartIndicatorsEnabled = localStorage.chartIndicatorsEnabled,
chartIndicators = chartIndicators,
balanceAutoHidden = balanceHiddenManager.balanceAutoHidden,
conversionTokenQueryId = baseTokenManager.token?.tokenQuery?.id,
language = languageManager.currentLocaleTag,
launchScreen = launchScreenService.optionsFlow.value.selected,
launchScreen = launchScreenService.selectedLaunchScreen,
marketsTabEnabled = localStorage.marketsTabEnabled,
balanceHideButtons = localStorage.balanceTabButtonsEnabled,
baseCurrency = currencyManager.baseCurrency.code,
btcModes = btcModes,
priceChangeMode = localStorage.priceChangeInterval,
evmSyncSources = evmSyncSources,
solanaSyncSource = solanaSyncSource,
)
Expand Down Expand Up @@ -705,11 +710,15 @@ data class Settings(
val launchScreen: LaunchPage,
@SerializedName("show_market")
val marketsTabEnabled: Boolean,
@SerializedName("balance_hide_buttons")
val balanceHideButtons: Boolean?,
@SerializedName("currency")
val baseCurrency: String,

@SerializedName("btc_modes")
val btcModes: List<BtcMode>,
@SerializedName("price_change_mode")
val priceChangeMode: PriceChangeInterval?,
@SerializedName("evm_sync_sources")
val evmSyncSources: EvmSyncSources,
@SerializedName("solana_sync_source")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ enum class AppIcon(val icon: Int, val titleText: String) : WithTranslatableTitle
}

enum class PriceChangeInterval(val raw: String, override val title: TranslatableString): WithTranslatableTitle {
LAST_24H("24h", TranslatableString.ResString(R.string.Market_PriceChange_24H)),
FROM_UTC_MIDNIGHT("utc", TranslatableString.ResString(R.string.Market_PriceChange_Utc));
LAST_24H("hour_24", TranslatableString.ResString(R.string.Market_PriceChange_24H)),
FROM_UTC_MIDNIGHT("midnight_utc", TranslatableString.ResString(R.string.Market_PriceChange_Utc));

companion object {
fun fromRaw(raw: String): PriceChangeInterval? {
Expand Down

0 comments on commit 17685cf

Please sign in to comment.