-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate MarketAdvancedSearch module to SwiftUI
- Loading branch information
Showing
26 changed files
with
848 additions
and
1,434 deletions.
There are no files selected for viewing
66 changes: 33 additions & 33 deletions
66
UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
UnstoppableWallet/UnstoppableWallet/Extensions/Advice.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import MarketKit | ||
|
||
extension TechnicalAdvice.Advice: Identifiable { | ||
public var id: Self { | ||
self | ||
} | ||
|
||
var shortTitle: String { | ||
switch self { | ||
case .oversold, .overbought: return "market.signal.risky".localized | ||
case .strongBuy: return "market.signal.strong_buy".localized | ||
case .buy: return "market.signal.buy".localized | ||
case .neutral: return "market.signal.neutral".localized | ||
case .sell: return "market.signal.sell".localized | ||
case .strongSell: return "market.signal.strong_sell".localized | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
UnstoppableWallet/UnstoppableWallet/Extensions/HsTimePeriod.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import MarketKit | ||
|
||
extension HsTimePeriod: Identifiable { | ||
public var id: String { | ||
rawValue | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...UnstoppableWallet/Modules/Market/AdvancedSearch/MarketAdvancedSearchBlockchainsView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import Kingfisher | ||
import MarketKit | ||
import SwiftUI | ||
|
||
struct MarketAdvancedSearchBlockchainsView: View { | ||
@ObservedObject var viewModel: MarketAdvancedSearchViewModel | ||
@Binding var isPresented: Bool | ||
|
||
var body: some View { | ||
ThemeNavigationView { | ||
ScrollableThemeView { | ||
VStack(spacing: .margin24) { | ||
ListSection { | ||
ClickableRow { | ||
viewModel.blockchains = Set() | ||
} content: { | ||
Text("selector.any".localized).themeBody(color: .themeGray) | ||
|
||
if viewModel.blockchains.isEmpty { | ||
Image("check_1_20").themeIcon(color: .themeJacob) | ||
} | ||
} | ||
|
||
ForEach(viewModel.allBlockchains) { blockchain in | ||
ClickableRow { | ||
if viewModel.blockchains.contains(blockchain) { | ||
viewModel.blockchains.remove(blockchain) | ||
} else { | ||
viewModel.blockchains.insert(blockchain) | ||
} | ||
} content: { | ||
KFImage.url(URL(string: blockchain.type.imageUrl)) | ||
.resizable() | ||
.placeholder { RoundedRectangle(cornerRadius: .cornerRadius8).fill(Color.themeSteel20) } | ||
.clipShape(RoundedRectangle(cornerRadius: .cornerRadius8)) | ||
.frame(width: .iconSize32, height: .iconSize32) | ||
|
||
Text(blockchain.name).themeBody() | ||
|
||
if viewModel.blockchains.contains(blockchain) { | ||
Image("check_1_20").themeIcon(color: .themeJacob) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
.padding(EdgeInsets(top: .margin12, leading: .margin16, bottom: .margin32, trailing: .margin16)) | ||
} | ||
.navigationTitle("market.advanced_search.blockchains".localized) | ||
.navigationBarTitleDisplayMode(.inline) | ||
.toolbar { | ||
ToolbarItem(placement: .confirmationAction) { | ||
Button("button.done".localized) { | ||
isPresented = false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.