Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info on 'Account' on extended key screen #5840

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,53 @@ class ExtendedKeyViewController: ThemeViewController {

present(alertController, animated: true)
}

private func openInfo(title: String, description: String) {
let viewController = BottomSheetModule.description(title: title, text: description)
present(viewController, animated: true)
}
}

extension ExtendedKeyViewController: SectionsDataSource {
private func controlRow(item: ControlItem, isFirst: Bool = false, isLast: Bool = false) -> RowProtocol {
tableView.universalRow48(
var elements = [CellBuilderNew.CellElement]()

if let description = item.description {
elements.append(contentsOf: [
.secondaryButton { [weak self] component in
component.button.set(style: .transparent2, image: UIImage(named: "circle_information_20"))
component.button.setTitle(item.title, for: .normal)
component.button.setTitleColor(.themeLeah, for: .normal)
component.button.titleLabel?.font = .body

component.button.snp.makeConstraints { maker in
maker.edges.equalToSuperview()
maker.centerY.equalToSuperview()
}

component.onTap = { [weak self] in
self?.openInfo(title: item.title, description: description)
}
},
.margin0,
.text { _ in },
])
} else {
elements.append(.textElement(text: .body(item.title)))
}

elements.append(.textElement(text: .subhead1(item.value, color: .themeGray), parameters: .allCompression))
elements.append(contentsOf: CellBuilderNew.CellElement.accessoryElements(item.action == nil ? .none : .dropdown))

return CellBuilderNew.row(
rootElement: .hStack(elements),
tableView: tableView,
id: item.id,
title: .body(item.title),
value: .subhead1(item.value, color: .themeGray),
accessoryType: item.action == nil ? .none : .dropdown,
height: .heightCell48,
autoDeselect: true,
isFirst: isFirst,
isLast: isLast,
bind: { cell in
cell.set(backgroundStyle: .lawrence, isFirst: isFirst, isLast: isLast)
},
action: item.action
)
}
Expand All @@ -159,6 +194,7 @@ extension ExtendedKeyViewController: SectionsDataSource {
id: "derivation",
title: "extended_key.purpose".localized,
value: viewItem.derivation,
description: nil,
action: viewItem.derivationSwitchable ? { [weak self] in
self?.onTapDerivation()
} : nil
Expand All @@ -171,6 +207,7 @@ extension ExtendedKeyViewController: SectionsDataSource {
id: "blockchain",
title: "extended_key.blockchain".localized,
value: blockchain,
description: nil,
action: viewItem.blockchainSwitchable ? { [weak self] in
self?.onTapBlockchain()
} : nil
Expand All @@ -184,6 +221,7 @@ extension ExtendedKeyViewController: SectionsDataSource {
id: "account",
title: "extended_key.account".localized,
value: account,
description: "extended_key.account.description".localized,
action: { [weak self] in
self?.onTapAccount()
}
Expand Down Expand Up @@ -268,6 +306,7 @@ extension ExtendedKeyViewController {
let id: String
let title: String
let value: String
let description: String?
var action: (() -> Void)?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
"extended_key.purpose" = "Purpose";
"extended_key.blockchain" = "Blockchain";
"extended_key.account" = "Account";
"extended_key.account.description" = "This is a setting for advanced users. If you are trying to import wallet (via extended private key )or transactions list (via  extended public key) you need account 0.";
"extended_key.tap_to_show" = "Tap to show extended private key";

// Backup
Expand Down