-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
187 additions
and
2 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
22 changes: 22 additions & 0 deletions
22
UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/Contents.json
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,22 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+1.22 KB
...leWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.71 KB
...leWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
110 changes: 110 additions & 0 deletions
110
...oppableWallet/UnstoppableWallet/Modules/Settings/Donate/DonateAddressViewController.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,110 @@ | ||
import UIKit | ||
import ActionSheet | ||
import ThemeKit | ||
import SectionsTableView | ||
import ComponentKit | ||
import MarketKit | ||
|
||
class DonateAddressViewController: ThemeViewController { | ||
typealias ViewItem = (String, BlockchainType, String) | ||
private let viewItems: [ViewItem] | ||
|
||
private let tableView = SectionsTableView(style: .grouped) | ||
|
||
override init() { | ||
var viewItems = [ViewItem]() | ||
|
||
for (coinName, address) in AppConfig.donationAddresses { | ||
switch coinName { | ||
case "BTC": viewItems.append(ViewItem("Bitcoin Address", .bitcoin, address)) | ||
case "ETH": viewItems.append(ViewItem("Ethereum Address", .ethereum, address)) | ||
case "BNB": viewItems.append(ViewItem("BNB Smart Chain Address", .binanceSmartChain, address)) | ||
default: () | ||
} | ||
} | ||
|
||
self.viewItems = viewItems | ||
|
||
super.init() | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
title = "settings.donate.title".localized | ||
navigationItem.largeTitleDisplayMode = .never | ||
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "button.done".localized, style: .plain, target: self, action: #selector(onTapDoneButton)) | ||
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) | ||
|
||
view.addSubview(tableView) | ||
tableView.snp.makeConstraints { maker in | ||
maker.left.right.bottom.equalToSuperview() | ||
maker.top.equalToSuperview().offset(CGFloat.margin24) | ||
} | ||
|
||
tableView.registerCell(forClass: MarkdownHeader1Cell.self) | ||
|
||
tableView.sectionDataSource = self | ||
tableView.separatorStyle = .none | ||
tableView.backgroundColor = .clear | ||
|
||
tableView.buildSections() | ||
} | ||
|
||
@objc private func onTapDoneButton() { | ||
dismiss(animated: true) | ||
} | ||
|
||
} | ||
|
||
extension DonateAddressViewController: SectionsDataSource { | ||
|
||
func buildSections() -> [SectionProtocol] { | ||
viewItems | ||
.sorted(by: { $0.1.order < $1.1.order }) | ||
.enumerated().map { index, viewItem -> SectionProtocol in | ||
Section( | ||
id: "section-id-\(index)", | ||
headerState: tableView.sectionHeader(text: viewItem.0), | ||
footerState: .margin(height: .margin24), | ||
rows: [ | ||
CellBuilderNew.row( | ||
rootElement: .hStack([ | ||
.image32 { (component: ImageComponent) -> () in | ||
component.setImage( | ||
urlString: viewItem.1.imageUrl, | ||
placeholder: UIImage(named: viewItem.1.placeholderImageName(tokenProtocol: .native)) | ||
) | ||
}, | ||
.text { component in | ||
component.font = .subhead2 | ||
component.textColor = .themeLeah | ||
component.text = viewItem.2 | ||
component.textAlignment = .right | ||
component.numberOfLines = 0 | ||
}, | ||
.secondaryCircleButton { component in | ||
component.button.set(image: UIImage(named: "copy_20")) | ||
component.onTap = { | ||
CopyHelper.copyAndNotify(value: viewItem.2) | ||
} | ||
} | ||
]), | ||
tableView: tableView, | ||
id: "donate-address-\(index)", | ||
hash: "donate-address-hash-\(index)", | ||
height: .heightCell56, | ||
bind: { cell in | ||
cell.set(backgroundStyle: .lawrence, isFirst: true, isLast: true) | ||
} | ||
) | ||
] | ||
) | ||
} | ||
} | ||
|
||
} |
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
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