Add Open Source development section

pull/2/head
Michael Scoff 7 years ago
parent 7c3da9a624
commit aca6c5d26e
  1. 30
      Trust/Settings/SettingsViewController.swift
  2. 10
      Trust/UI/FormAppearance.swift

@ -2,6 +2,7 @@
import UIKit
import Eureka
import SafariServices
enum SettingsAction {
case exportPrivateKey
@ -24,12 +25,10 @@ class SettingsViewController: FormViewController {
form = Section("Export")
<<< ButtonRow("Export Private Key") {
<<< AppFormAppearance.button("Export Private Key") {
$0.title = $0.tag
}.onCellSelection { [weak self] (cell, row) in
self?.run(action: .exportPrivateKey)
}.cellUpdate { cell, row in
cell.textLabel?.textAlignment = .left
}.onCellSelection { [unowned self] (cell, row) in
self.run(action: .exportPrivateKey)
}
+++ Section()
@ -49,6 +48,22 @@ class SettingsViewController: FormViewController {
selectorController.enableDeselection = false
}
+++ Section("Open source development")
<<< AppFormAppearance.button() {
$0.title = "iOS Client"
$0.value = "https://github.com/TrustWallet/trust-wallet-ios"
}.onCellSelection { [unowned self] (cell, row) in
self.openURL(URL(string: row.value!)!)
}
<<< AppFormAppearance.button() {
$0.title = "Road Map"
$0.value = "https://github.com/TrustWallet/trust-wallet-ios/projects/1"
}.onCellSelection { [unowned self] (cell, row) in
self.openURL(URL(string: row.value!)!)
}
+++ Section()
<<< TextRow() {
@ -67,4 +82,9 @@ class SettingsViewController: FormViewController {
func run(action: SettingsAction) {
delegate?.didAction(action: action, in: self)
}
func openURL(_ url: URL) {
let controller = SFSafariViewController(url: url)
present(controller, animated: true, completion: nil)
}
}

@ -81,4 +81,14 @@ struct AppFormAppearance {
callback(textField)
return textField
}
static func button(_ title: String? = .none, callback: @escaping (ButtonRow) -> Void) -> ButtonRow {
let button = ButtonRow(title)
.cellUpdate { cell, row in
cell.textLabel?.textAlignment = .left
cell.textLabel?.textColor = .black
}
callback(button)
return button
}
}

Loading…
Cancel
Save