From ab6ff799ba7554df2a691a188df207e271a551cc Mon Sep 17 00:00:00 2001 From: Brandon McAnsh Date: Fri, 21 Aug 2026 16:33:58 -0400 Subject: [PATCH] chore(ui): drop the unreachable sell branch from swap processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing the newUI beta flag deleted the Currency Sell flow, which held the only `swapType: .sell` call site. Convert replaces it and carries its own case, so nothing constructs a sell any more. Drop the case from SwapType and the arms it fed in title, subtitle, navigationTitle, and trackTransaction. Convert keeps reporting through Analytics.tokenSell — it still disposes of the source token — so only the unreachable path goes. The tests asserting a fourth case and the "Selling" title go with it. --- .../Main/Currency Swap/SwapProcessingViewModel.swift | 12 ++---------- FlipcashTests/SwapProcessingViewModelTests.swift | 6 ++---- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Flipcash/Core/Screens/Main/Currency Swap/SwapProcessingViewModel.swift b/Flipcash/Core/Screens/Main/Currency Swap/SwapProcessingViewModel.swift index 89f71028a..10a1e4cae 100644 --- a/Flipcash/Core/Screens/Main/Currency Swap/SwapProcessingViewModel.swift +++ b/Flipcash/Core/Screens/Main/Currency Swap/SwapProcessingViewModel.swift @@ -29,8 +29,6 @@ class SwapProcessingViewModel { // Convert names its destination via `currencyName`, so the // same "X of " reads correctly there too. return "\(exchangedFiat.nativeAmount.formatted()) of \(currencyName)" - case .sell: - return "\(exchangedFiat.nativeAmount.formatted()) of USDF" } } return "Transaction Complete" @@ -45,7 +43,7 @@ class SwapProcessingViewModel { return "This transaction typically takes about a minute. You may leave the app while it completes" case .success: switch swapType { - case .buyWithReserves, .buyWithCurrency, .sell, .convert: + case .buyWithReserves, .buyWithCurrency, .convert: return "was just added to your Flipcash wallet" } case .failed: @@ -70,8 +68,6 @@ class SwapProcessingViewModel { switch swapType { case .buyWithReserves, .buyWithCurrency: "Buying \(currencyName)" - case .sell: - "Selling \(currencyName)" case .convert: "Converting" } @@ -94,8 +90,7 @@ class SwapProcessingViewModel { private let swapId: SwapId private let swapType: SwapType - /// The token being bought — analytics-only; nil on the sell path, where - /// `amount.mint` already names the subject token. + /// The token being bought, or a convert's destination — analytics-only. private let targetMint: PublicKey? private let currencyName: String private let amount: ExchangedFiat @@ -191,8 +186,6 @@ class SwapProcessingViewModel { Analytics.tokenPurchase(method: .purchaseWithReserves, targetMint: targetMint, exchangedFiat: amount, successful: successful) case .buyWithCurrency: Analytics.tokenPurchase(method: .purchaseWithCurrency, targetMint: targetMint, exchangedFiat: amount, successful: successful) - case .sell: - Analytics.tokenSell(exchangedFiat: amount, successful: successful) case .convert: // A convert always disposes of the source token; record it as a // sell of the amount that left the wallet. @@ -222,7 +215,6 @@ enum SwapError: Error { nonisolated enum SwapType: CaseIterable { case buyWithReserves case buyWithCurrency - case sell /// Selling one currency straight into another (source → USDF, or source → /// another launchpad token). Drives the "Converting" copy. case convert diff --git a/FlipcashTests/SwapProcessingViewModelTests.swift b/FlipcashTests/SwapProcessingViewModelTests.swift index 0882606e2..3e0923e74 100644 --- a/FlipcashTests/SwapProcessingViewModelTests.swift +++ b/FlipcashTests/SwapProcessingViewModelTests.swift @@ -12,12 +12,11 @@ import FlipcashCore @MainActor struct SwapProcessingViewModelTests { - @Test("SwapType exposes the reserves, currency-paid, sell, and convert cases") + @Test("SwapType exposes the reserves, currency-paid, and convert cases") func swapType_exposesExpectedCases() { - #expect(SwapType.allCases.count == 4) + #expect(SwapType.allCases.count == 3) #expect(SwapType.allCases.contains(.buyWithReserves)) #expect(SwapType.allCases.contains(.buyWithCurrency)) - #expect(SwapType.allCases.contains(.sell)) #expect(SwapType.allCases.contains(.convert)) } @@ -33,7 +32,6 @@ struct SwapProcessingViewModelTests { } #expect(makeViewModel(.buyWithReserves).navigationTitle == "Buying TestCoin") #expect(makeViewModel(.buyWithCurrency).navigationTitle == "Buying TestCoin") - #expect(makeViewModel(.sell).navigationTitle == "Selling TestCoin") // Convert spans two currencies, so the title names neither. #expect(makeViewModel(.convert).navigationTitle == "Converting") }