Skip to content

Commit

Permalink
Remove old Market modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Jun 4, 2024
1 parent 7b97554 commit dc83150
Show file tree
Hide file tree
Showing 118 changed files with 181 additions and 9,001 deletions.
806 changes: 42 additions & 764 deletions UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class LocalStorage {
private let keyUserChartIndicatorsSync = "user-chart-indicators"
private let keyIndicatorsShown = "indicators-shown"
private let keyTelegramSupportRequested = "telegram-support-requested"
private let keyNewMarketTabEnabled = "new-market-tab-enabled"
private let keyNewSendEnabled = "new-send-enabled"

private let userDefaultsStorage: UserDefaultsStorage
Expand Down Expand Up @@ -94,11 +93,6 @@ extension LocalStorage {
set { userDefaultsStorage.set(value: newValue, for: keyTelegramSupportRequested) }
}

var newMarketTabEnabled: Bool {
get { userDefaultsStorage.value(for: keyNewMarketTabEnabled) ?? false }
set { userDefaultsStorage.set(value: newValue, for: keyNewMarketTabEnabled) }
}

var newSendEnabled: Bool {
get { userDefaultsStorage.value(for: keyNewSendEnabled) ?? false }
set { userDefaultsStorage.set(value: newValue, for: keyNewSendEnabled) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import Foundation
import MarketKit

extension DefiCoin: Hashable {
extension DefiCoin {
var name: String {
switch type {
case let .defiCoin(name, _): return name
case let .fullCoin(fullCoin): return fullCoin.coin.name
}
}
}

extension DefiCoin: Hashable {
public static func == (lhs: DefiCoin, rhs: DefiCoin) -> Bool {
lhs.uid == rhs.uid
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ extension MarketModule.Tab {
}
}

extension MarketModule.TabOld {
var statTab: StatTab {
switch self {
case .overview: return .overview
case .posts: return .news
case .watchlist: return .watchlist
}
}
}

extension CoinPageModule.Tab {
var statTab: StatTab {
switch self {
Expand Down Expand Up @@ -124,7 +114,7 @@ extension CoinProChartModule.ProChartType {
}
}

extension CoinRankModule.RankType {
extension RankViewModel.RankType {
var statRankType: StatPage {
switch self {
case .cexVolume: return .coinRankCexVolume
Expand Down Expand Up @@ -153,48 +143,6 @@ extension MarketModule.Top {
}
}

extension MarketModule.MarketTop {
var statMarketTop: StatMarketTop {
switch self {
case .top100: return .top100
case .top200: return .top200
case .top300: return .top300
}
}
}

extension MarketModule.PriceChangeType {
var statPeriod: StatPeriod {
switch self {
case .day: return .day1
case .week: return .week1
case .week2: return .week2
case .month: return .month1
case .month6: return .month6
case .year: return .year1
}
}
}

extension MarketModule.MarketField {
var statField: StatField {
switch self {
case .marketCap: return .marketCap
case .volume: return .volume
case .price: return .price
}
}
}

extension MarketModule.MarketPlatformField {
var statTvlChain: String {
switch self {
case .all: return "all"
default: return chain
}
}
}

extension MarketModule.SortBy {
var statSortType: StatSortType {
switch self {
Expand Down Expand Up @@ -229,15 +177,6 @@ extension MarketModule.SortOrder {
}
}

extension MarketModule.MarketTvlField {
var statField: String {
switch self {
case .value: return "currency"
case .diff: return "percent"
}
}
}

extension MarketTvlViewModel.DiffType {
var statField: String {
switch self {
Expand Down Expand Up @@ -285,30 +224,6 @@ extension WatchlistTimePeriod {
}
}

extension MarketModule.SortingField {
var statSortType: StatSortType {
switch self {
case .highestCap: return .highestCap
case .lowestCap: return .lowestCap
case .highestVolume: return .highestVolume
case .lowestVolume: return .lowestVolume
case .topGainers: return .topGainers
case .topLosers: return .topLosers
}
}
}

extension MarketTopPlatformsModule.SortType {
var statSortType: StatSortType {
switch self {
case .highestCap: return .highestCap
case .lowestCap: return .lowestCap
case .topGainers: return .topGainers
case .topLosers: return .topLosers
}
}
}

extension LinkType {
var statPage: StatPage {
switch self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ class CoinAnalyticsViewController: ThemeViewController {
}

private func openTvlRank() {
let viewController = MarketGlobalMetricModule.tvlInDefiViewController()
let viewController = MarketTvlView().toViewController()
parentNavigationController?.pushViewController(viewController, animated: true)
}

Expand Down Expand Up @@ -404,8 +404,8 @@ class CoinAnalyticsViewController: ThemeViewController {
parentNavigationController?.present(viewController, animated: true)
}

private func openRanks(type: CoinRankModule.RankType) {
let viewController = CoinRankModule.newView(type: type)
private func openRanks(type: RankViewModel.RankType) {
let viewController = RankView(type: type).toViewController()
parentNavigationController?.present(viewController, animated: true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import SwiftUI
struct RankView: View {
@StateObject var viewModel: RankViewModel
@StateObject var watchlistViewModel: WatchlistViewModel
@Binding var isPresented: Bool

@Environment(\.presentationMode) private var presentationMode

@State private var presentedCoin: Coin?
@State private var timePeriodSelectorPresented = false

init(isPresented: Binding<Bool>, type: CoinRankModule.RankType) {
init(type: RankViewModel.RankType) {
_viewModel = StateObject(wrappedValue: RankViewModel(type: type))
_watchlistViewModel = StateObject(wrappedValue: WatchlistViewModel(page: type.statRankType))
_isPresented = isPresented
}

var body: some View {
Expand Down Expand Up @@ -50,7 +50,7 @@ struct RankView: View {
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button("button.close".localized) {
isPresented = false
presentationMode.wrappedValue.dismiss()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import MarketKit
class RankViewModel: ObservableObject {
private let marketKit = App.shared.marketKit
private let currencyManager = App.shared.currencyManager
let type: CoinRankModule.RankType
let type: RankType

private var cancellables = Set<AnyCancellable>()
private var tasks = Set<AnyTask>()
Expand All @@ -33,7 +33,7 @@ class RankViewModel: ObservableObject {
}
}

init(type: CoinRankModule.RankType) {
init(type: RankType) {
self.type = type

currencyManager.$baseCurrency
Expand Down Expand Up @@ -180,56 +180,67 @@ extension RankMultiValue {
}
}

extension CoinRankModule.RankType {
var title: String {
switch self {
case .cexVolume: return "coin_analytics.cex_volume_rank".localized
case .dexVolume: return "coin_analytics.dex_volume_rank".localized
case .dexLiquidity: return "coin_analytics.dex_liquidity_rank".localized
case .address: return "coin_analytics.active_addresses_rank".localized
case .txCount: return "coin_analytics.transaction_count_rank".localized
case .holders: return "coin_analytics.holders_rank".localized
case .fee: return "coin_analytics.project_fee_rank".localized
case .revenue: return "coin_analytics.project_revenue_rank".localized
extension RankViewModel {
enum RankType {
case cexVolume
case dexVolume
case dexLiquidity
case address
case txCount
case holders
case fee
case revenue

var title: String {
switch self {
case .cexVolume: return "coin_analytics.cex_volume_rank".localized
case .dexVolume: return "coin_analytics.dex_volume_rank".localized
case .dexLiquidity: return "coin_analytics.dex_liquidity_rank".localized
case .address: return "coin_analytics.active_addresses_rank".localized
case .txCount: return "coin_analytics.transaction_count_rank".localized
case .holders: return "coin_analytics.holders_rank".localized
case .fee: return "coin_analytics.project_fee_rank".localized
case .revenue: return "coin_analytics.project_revenue_rank".localized
}
}
}

var description: String {
switch self {
case .cexVolume: return "coin_analytics.cex_volume_rank.description".localized
case .dexVolume: return "coin_analytics.dex_volume_rank.description".localized
case .dexLiquidity: return "coin_analytics.dex_liquidity_rank.description".localized
case .address: return "coin_analytics.active_addresses_rank.description".localized
case .txCount: return "coin_analytics.transaction_count_rank.description".localized
case .holders: return "coin_analytics.holders_rank.description".localized
case .fee: return "coin_analytics.project_fee_rank.description".localized
case .revenue: return "coin_analytics.project_revenue_rank.description".localized
var description: String {
switch self {
case .cexVolume: return "coin_analytics.cex_volume_rank.description".localized
case .dexVolume: return "coin_analytics.dex_volume_rank.description".localized
case .dexLiquidity: return "coin_analytics.dex_liquidity_rank.description".localized
case .address: return "coin_analytics.active_addresses_rank.description".localized
case .txCount: return "coin_analytics.transaction_count_rank.description".localized
case .holders: return "coin_analytics.holders_rank.description".localized
case .fee: return "coin_analytics.project_fee_rank.description".localized
case .revenue: return "coin_analytics.project_revenue_rank.description".localized
}
}
}

var imageUid: String {
switch self {
case .cexVolume: return "cex_volume"
case .dexVolume: return "dex_volume"
case .dexLiquidity: return "dex_liquidity"
case .address: return "active_addresses"
case .txCount: return "trx_count"
case .holders: return "holders"
case .fee: return "fee"
case .revenue: return "revenue"
var imageUid: String {
switch self {
case .cexVolume: return "cex_volume"
case .dexVolume: return "dex_volume"
case .dexLiquidity: return "dex_liquidity"
case .address: return "active_addresses"
case .txCount: return "trx_count"
case .holders: return "holders"
case .fee: return "fee"
case .revenue: return "revenue"
}
}
}

var sortingField: String {
switch self {
case .cexVolume: return "coin_analytics.cex_volume_rank.sorting_field".localized
case .dexVolume: return "coin_analytics.dex_volume_rank.sorting_field".localized
case .dexLiquidity: return "coin_analytics.dex_liquidity_rank.sorting_field".localized
case .address: return "coin_analytics.active_addresses_rank.sorting_field".localized
case .txCount: return "coin_analytics.transaction_count_rank.sorting_field".localized
case .holders: return "coin_analytics.holders_rank.sorting_field".localized
case .fee: return "coin_analytics.project_fee_rank.sorting_field".localized
case .revenue: return "coin_analytics.project_revenue_rank.sorting_field".localized
var sortingField: String {
switch self {
case .cexVolume: return "coin_analytics.cex_volume_rank.sorting_field".localized
case .dexVolume: return "coin_analytics.dex_volume_rank.sorting_field".localized
case .dexLiquidity: return "coin_analytics.dex_liquidity_rank.sorting_field".localized
case .address: return "coin_analytics.active_addresses_rank.sorting_field".localized
case .txCount: return "coin_analytics.transaction_count_rank.sorting_field".localized
case .holders: return "coin_analytics.holders_rank.sorting_field".localized
case .fee: return "coin_analytics.project_fee_rank.sorting_field".localized
case .revenue: return "coin_analytics.project_revenue_rank.sorting_field".localized
}
}
}
}
Loading

0 comments on commit dc83150

Please sign in to comment.