-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate CoinAudits module into SwiftUI
- Loading branch information
Showing
6 changed files
with
108 additions
and
209 deletions.
There are no files selected for viewing
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
23 changes: 0 additions & 23 deletions
23
UnstoppableWallet/UnstoppableWallet/Modules/Coin/Audits/CoinAuditsModule.swift
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
UnstoppableWallet/UnstoppableWallet/Modules/Coin/Audits/CoinAuditsView.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,72 @@ | ||
import Kingfisher | ||
import MarketKit | ||
import SwiftUI | ||
|
||
struct CoinAuditsView: View { | ||
@StateObject var viewModel: CoinAuditsViewModel | ||
|
||
init(audits: [Analytics.Audit]) { | ||
_viewModel = StateObject(wrappedValue: CoinAuditsViewModel(audits: audits)) | ||
} | ||
|
||
var body: some View { | ||
ThemeView { | ||
ScrollView { | ||
LazyVStack(spacing: .margin24) { | ||
ForEach(viewModel.viewItems.indices, id: \.self) { index in | ||
let viewItem = viewModel.viewItems[index] | ||
|
||
VStack(spacing: .margin12) { | ||
VStack(spacing: 0) { | ||
HorizontalDivider() | ||
|
||
HStack(spacing: .margin16) { | ||
KFImage.url(viewItem.logoUrl.flatMap { URL(string: $0) }) | ||
.resizable() | ||
.placeholder { RoundedRectangle(cornerRadius: .cornerRadius8).fill(Color.themeSteel20) } | ||
.clipShape(RoundedRectangle(cornerRadius: .cornerRadius8)) | ||
.frame(width: .iconSize32, height: .iconSize32) | ||
|
||
Text(viewItem.name).themeBody() | ||
} | ||
.padding(.horizontal, .margin16) | ||
.padding(.vertical, .margin12) | ||
} | ||
|
||
ListSection { | ||
ForEach(viewItem.auditViewItems.indices, id: \.self) { index in | ||
let audit = viewItem.auditViewItems[index] | ||
|
||
ClickableRow(spacing: .margin8) { | ||
if let url = audit.reportUrl { | ||
UrlManager.open(url: url) | ||
} | ||
} content: { | ||
VStack(alignment: .leading, spacing: 1) { | ||
Text(audit.date).textBody() | ||
Text(audit.name).textSubhead2() | ||
} | ||
|
||
Spacer() | ||
|
||
Text(audit.issues).textSubhead1() | ||
Image.disclosureIcon | ||
} | ||
} | ||
} | ||
.padding(.horizontal, .margin16) | ||
} | ||
} | ||
|
||
VStack(spacing: .margin12) { | ||
HorizontalDivider() | ||
Text("Powered by Defiyield.app").textCaption() | ||
} | ||
} | ||
.padding(EdgeInsets(top: .margin12, leading: 0, bottom: .margin32, trailing: 0)) | ||
} | ||
} | ||
.navigationTitle("coin_analytics.audits".localized) | ||
.navigationBarTitleDisplayMode(.inline) | ||
} | ||
} |
153 changes: 0 additions & 153 deletions
153
UnstoppableWallet/UnstoppableWallet/Modules/Coin/Audits/CoinAuditsViewController.swift
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.