diff --git a/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj b/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj index 1d3882317d..b685e9d9eb 100644 --- a/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj +++ b/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj @@ -2332,6 +2332,8 @@ D05F132F2A31FE0D00C3193F /* AddTronTokenBlockchainService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05F132D2A31FE0D00C3193F /* AddTronTokenBlockchainService.swift */; }; D06669022A31B559004B048D /* TronRecipientAddressViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06669012A31B559004B048D /* TronRecipientAddressViewModel.swift */; }; D06669032A31B559004B048D /* TronRecipientAddressViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06669012A31B559004B048D /* TronRecipientAddressViewModel.swift */; }; + D06F756F2A8BA35F00184227 /* DonateAddressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06F756E2A8BA35F00184227 /* DonateAddressViewController.swift */; }; + D06F75702A8BA35F00184227 /* DonateAddressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06F756E2A8BA35F00184227 /* DonateAddressViewController.swift */; }; D07157DB2A2DD968006F141F /* SendTronModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07157DA2A2DD968006F141F /* SendTronModule.swift */; }; D07157DC2A2DD968006F141F /* SendTronModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07157DA2A2DD968006F141F /* SendTronModule.swift */; }; D07157DE2A2DDA09006F141F /* SendTronService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07157DD2A2DDA09006F141F /* SendTronService.swift */; }; @@ -3797,6 +3799,7 @@ D05E96B82A2A1113002CCD71 /* WatchTronService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchTronService.swift; sourceTree = ""; }; D05F132D2A31FE0D00C3193F /* AddTronTokenBlockchainService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddTronTokenBlockchainService.swift; sourceTree = ""; }; D06669012A31B559004B048D /* TronRecipientAddressViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TronRecipientAddressViewModel.swift; sourceTree = ""; }; + D06F756E2A8BA35F00184227 /* DonateAddressViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DonateAddressViewController.swift; sourceTree = ""; }; D07157DA2A2DD968006F141F /* SendTronModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendTronModule.swift; sourceTree = ""; }; D07157DD2A2DDA09006F141F /* SendTronService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendTronService.swift; sourceTree = ""; }; D07157E02A2DDA17006F141F /* SendTronViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendTronViewModel.swift; sourceTree = ""; }; @@ -5052,6 +5055,7 @@ 11B3563CCEF5817CCA5A0C6A /* Appearance */, 1A5648A0CFE0BED4703D9794 /* Privacy */, 11B35C3CD4FFDE56E8E30B80 /* BlockchainSettings */, + D06F756D2A8BA33000184227 /* Donate */, ); path = Settings; sourceTree = ""; @@ -7251,6 +7255,14 @@ path = Evm; sourceTree = ""; }; + D06F756D2A8BA33000184227 /* Donate */ = { + isa = PBXGroup; + children = ( + D06F756E2A8BA35F00184227 /* DonateAddressViewController.swift */, + ); + path = Donate; + sourceTree = ""; + }; D07157D72A2DD7A8006F141F /* SendTron */ = { isa = PBXGroup; children = ( @@ -8249,6 +8261,7 @@ 2FA5D4C4D13E610DA6009C48 /* CoinOverviewViewModel.swift in Sources */, D05E969E2A2627AF002CCD71 /* TronContractCallTransactionRecord.swift in Sources */, 2FA5D72F396BC5D16C228112 /* CoinOverviewService.swift in Sources */, + D06F75702A8BA35F00184227 /* DonateAddressViewController.swift in Sources */, 2FA5DF327EC188AC29719179 /* CoinOverviewModule.swift in Sources */, 2FA5D0F37E1B46988A88DB29 /* CoinOverviewViewController.swift in Sources */, 11B35CD199C820EC89FBB546 /* MarketListViewModel.swift in Sources */, @@ -9494,6 +9507,7 @@ D05E969A2A26278D002CCD71 /* TronApproveTransactionRecord.swift in Sources */, 2FA5D40FA7CAC1BA01C0B373 /* CoinOverviewViewModel.swift in Sources */, 2FA5DBE42827FF3D114DBF4B /* CoinOverviewService.swift in Sources */, + D06F756F2A8BA35F00184227 /* DonateAddressViewController.swift in Sources */, 2FA5DF4BB73C12C8DDF42599 /* CoinOverviewModule.swift in Sources */, D05E969D2A2627AF002CCD71 /* TronContractCallTransactionRecord.swift in Sources */, 2FA5DF596B5EE00090E050D9 /* CoinOverviewViewController.swift in Sources */, diff --git a/UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/Contents.json b/UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/Contents.json new file mode 100644 index 0000000000..58ce5adc30 --- /dev/null +++ b/UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "heart@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "heart@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/heart@2x.png b/UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/heart@2x.png new file mode 100644 index 0000000000..b95039ca35 Binary files /dev/null and b/UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/heart@2x.png differ diff --git a/UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/heart@3x.png b/UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/heart@3x.png new file mode 100644 index 0000000000..73f3ee51d8 Binary files /dev/null and b/UnstoppableWallet/UnstoppableWallet/Assets.xcassets/Icons/heart_48.imageset/heart@3x.png differ diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Chart/ChartCell.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Chart/ChartCell.swift index a8d5f6198c..074df7bda6 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Chart/ChartCell.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Chart/ChartCell.swift @@ -340,7 +340,9 @@ class ChartCell: UITableViewCell { chartSecondaryTitleLabel.isHidden = false chartSecondaryValueLabel.isHidden = false chartSecondaryTitleLabel.attributedText = top + chartSecondaryTitleLabel.lineBreakMode = .byTruncatingTail chartSecondaryValueLabel.attributedText = bottom + chartSecondaryValueLabel.lineBreakMode = .byTruncatingTail chartSecondaryDiffLabel.isHidden = true } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Donate/DonateAddressViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Donate/DonateAddressViewController.swift new file mode 100644 index 0000000000..6e93dfe7e5 --- /dev/null +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Donate/DonateAddressViewController.swift @@ -0,0 +1,101 @@ +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() { + viewItems = [ + ViewItem("Bitcoin Address", .bitcoin, "bc1qw5tw4cnyt0vxts70ntdzxesn2zzz97t6r29pjj"), + ViewItem("Ethereum Address", .ethereum, "0x8a2Bec907827F496752c3F24F960B3cddc5D311B"), + ViewItem("BNB Smart Chain Address", .binanceSmartChain, "0x8a2Bec907827F496752c3F24F960B3cddc5D311B") + ] + + 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.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) + } + ) + ] + ) + } + } + +} diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift index 976619a1cf..bd6d00a7fc 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift @@ -56,6 +56,8 @@ class MainSettingsViewController: ThemeViewController { tableView.separatorStyle = .none tableView.backgroundColor = .clear + tableView.registerCell(forClass: PlaceholderCell.self) + view.addSubview(tableView) tableView.snp.makeConstraints { maker in maker.edges.equalToSuperview() @@ -196,6 +198,10 @@ class MainSettingsViewController: ThemeViewController { ])) } + @objc private func onDonateTapped() { + present(ThemeNavigationController(rootViewController: DonateAddressViewController()), animated: true) + } + private var accountRows: [RowProtocol] { [ StaticRow( @@ -336,6 +342,26 @@ class MainSettingsViewController: ThemeViewController { ] } + private var donateRows: [RowProtocol] { + [ + Row( + id: "donate", + autoDeselect: true, + dynamicHeight: { containerWidth in PlaceholderCell.height(text: "settings.donate.description".localized) }, + bind: { cell, _ in + cell.set(backgroundStyle: .lawrence, isFirst: true, isLast: true) + cell.bind( + icon: UIImage(named: "heart_48")?.withTintColor(.themeJacob), + text: "settings.donate.description".localized, + buttonTitle: "settings.donate.title".localized, + buttonStyle: .yellow, + onTapButton: { [weak self] in self?.onDonateTapped() } + ) + } + ) + ] + } + private var footerRows: [RowProtocol] { [ StaticRow( @@ -367,6 +393,7 @@ extension MainSettingsViewController: SectionsDataSource { Section(id: "experimental", headerState: .margin(height: .margin32), rows: experimentalRows), Section(id: "knowledge", headerState: .margin(height: .margin32), rows: knowledgeRows), Section(id: "about", headerState: .margin(height: .margin32), rows: aboutRows), + Section(id: "donate", headerState: .margin(height: .margin32), rows: donateRows), Section(id: "footer", headerState: .margin(height: .margin32), footerState: .margin(height: .margin32), rows: footerRows) ] diff --git a/UnstoppableWallet/UnstoppableWallet/UserInterface/Cells/PlaceholderCell.swift b/UnstoppableWallet/UnstoppableWallet/UserInterface/Cells/PlaceholderCell.swift index 7cb6b53732..ea07f2aeea 100644 --- a/UnstoppableWallet/UnstoppableWallet/UserInterface/Cells/PlaceholderCell.swift +++ b/UnstoppableWallet/UnstoppableWallet/UserInterface/Cells/PlaceholderCell.swift @@ -7,7 +7,7 @@ class PlaceholderCell: BaseThemeCell { private static let verticalPadding: CGFloat = .margin32 private static let iconWrapperSize: CGFloat = 100 private static let contentWidth: CGFloat = 264 - private static let textFont: UIFont = .subhead2 + private static let textFont: UIFont = .headline2 private let iconImageView = UIImageView() private let label = UILabel() @@ -39,7 +39,7 @@ class PlaceholderCell: BaseThemeCell { label.numberOfLines = 0 label.textAlignment = .center label.font = Self.textFont - label.textColor = .themeGray + label.textColor = .themeLeah wrapperView.addSubview(button) button.snp.makeConstraints { maker in diff --git a/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings index 4709ed7f78..ce65cf0f8f 100644 --- a/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings @@ -963,6 +963,8 @@ Go to Settings - > %@ and allow access to the camera."; "settings.faq" = "FAQ"; "settings.theme" = "Theme"; "settings.info_subtitle" = "decentralized app"; +"settings.donate.description" = "Together, with your support, we can make this app even better!"; +"settings.donate.title" = "Donate"; // Settings -> Base Currency