diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Managers/BalanceConversionManager.swift b/UnstoppableWallet/UnstoppableWallet/Core/Managers/BalanceConversionManager.swift index 09e45898fe..e92d80aab8 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Managers/BalanceConversionManager.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Managers/BalanceConversionManager.swift @@ -5,7 +5,6 @@ class BalanceConversionManager { private let tokenQueries = [ TokenQuery(blockchainType: .bitcoin, tokenType: .derived(derivation: .bip84)), TokenQuery(blockchainType: .ethereum, tokenType: .native), - TokenQuery(blockchainType: .binanceSmartChain, tokenType: .native), ] private let keyBlockchainUid = "conversion-blockchain-uid" @@ -66,6 +65,7 @@ extension BalanceConversionManager { func set(tokenQueryId: String?) { conversionToken = tokenQueryId .flatMap { TokenQuery(id: $0) } + .flatMap { tokenQueries.contains($0) ? $0 : nil } .flatMap { try? marketKit.token(query: $0) } ?? conversionTokens.first } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Appearance/AppearanceView.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Appearance/AppearanceView.swift index 90afabdfd4..94e3f77bd4 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Appearance/AppearanceView.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Appearance/AppearanceView.swift @@ -9,7 +9,6 @@ struct AppearanceView: View { @State private var priceChangeSelectorPresented = false @State private var launchScreenSelectorPresented = false @State private var balanceValueSelectorPresented = false - @State private var conversionSelectorPresented = false var body: some View { ScrollableThemeView { @@ -125,27 +124,6 @@ struct AppearanceView: View { viewModel.balancePrimaryValue = BalancePrimaryValue.allCases[index] } ) - - ClickableRow(spacing: .margin8) { - conversionSelectorPresented = true - } content: { - Text("appearance.balance_conversion".localized).textBody() - Spacer() - Text(viewModel.conversionToken?.coin.code ?? "").textSubhead1() - Image("arrow_small_down_20").themeIcon() - } - .alert( - isPresented: $conversionSelectorPresented, - title: "appearance.balance_conversion".localized, - viewItems: viewModel.conversionTokens.map { .init(text: $0.coin.code, selected: viewModel.conversionToken == $0) }, - onTap: { index in - guard let index else { - return - } - - viewModel.conversionToken = viewModel.conversionTokens[index] - } - ) } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Appearance/AppearanceViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Appearance/AppearanceViewModel.swift index 4f3c39b4d1..b048e1f493 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Appearance/AppearanceViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Appearance/AppearanceViewModel.swift @@ -4,18 +4,14 @@ import SwiftUI import ThemeKit class AppearanceViewModel: ObservableObject { - private var cancellables = Set() - private let themeManager = App.shared.themeManager private let launchScreenManager = App.shared.launchScreenManager private let appIconManager = App.shared.appIconManager private let balancePrimaryValueManager = App.shared.balancePrimaryValueManager - private let balanceConversionManager = App.shared.balanceConversionManager private let walletButtonHiddenManager = App.shared.walletButtonHiddenManager private let priceChangeModeManager = App.shared.priceChangeModeManager let themeModes: [ThemeMode] = [.system, .dark, .light] - let conversionTokens: [Token] @Published var themeMode: ThemeMode { didSet { @@ -77,18 +73,6 @@ class AppearanceViewModel: ObservableObject { } } - @Published var conversionToken: Token? { - didSet { - guard balanceConversionManager.conversionToken != conversionToken else { - return - } - if let conversionToken { - stat(page: .appearance, event: .selectBalanceConversion(coinUid: conversionToken.coin.uid)) - } - balanceConversionManager.set(conversionToken: conversionToken) - } - } - @Published var appIcon: AppIcon { didSet { guard appIconManager.appIcon != appIcon else { @@ -100,17 +84,12 @@ class AppearanceViewModel: ObservableObject { } init() { - conversionTokens = balanceConversionManager.conversionTokens - themeMode = themeManager.themeMode hideMarkets = !launchScreenManager.showMarket priceChangeMode = priceChangeModeManager.priceChangeMode launchScreen = launchScreenManager.launchScreen hideBalanceButtons = walletButtonHiddenManager.buttonHidden balancePrimaryValue = balancePrimaryValueManager.balancePrimaryValue - conversionToken = balanceConversionManager.conversionToken appIcon = appIconManager.appIcon - - balanceConversionManager.$conversionToken.sink { [weak self] in self?.conversionToken = $0 }.store(in: &cancellables) } } diff --git a/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings index 6ad6caa85d..b795dc2b68 100644 --- a/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings @@ -1556,7 +1556,6 @@ "appearance.balance_value" = "Balance Value"; "appearance.balance_value.coin_fiat" = "Coin / Fiat"; "appearance.balance_value.fiat_coin" = "Fiat / Coin"; -"appearance.balance_conversion" = "Balance Conversion"; "appearance.app_icon" = "App Icon";