|
|
@ -14,6 +14,8 @@ class SettingsViewController: FormViewController { |
|
|
|
|
|
|
|
|
|
|
|
struct Values { |
|
|
|
struct Values { |
|
|
|
static let donationAddress = Address(address: "0x9f8284ce2cf0c8ce10685f537b1fff418104a317") |
|
|
|
static let donationAddress = Address(address: "0x9f8284ce2cf0c8ce10685f537b1fff418104a317") |
|
|
|
|
|
|
|
static let currencyPopularKey = "0" |
|
|
|
|
|
|
|
static let currencyAllKey = "1" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private var config = Config() |
|
|
|
private var config = Config() |
|
|
@ -78,27 +80,6 @@ class SettingsViewController: FormViewController { |
|
|
|
cell.imageView?.image = R.image.settings_server() |
|
|
|
cell.imageView?.image = R.image.settings_server() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
+++ Section(NSLocalizedString("settings.currency.button.title", value: "Currency", comment: "")) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<<< PushRow<String> { |
|
|
|
|
|
|
|
$0.title = NSLocalizedString("settings.currency.button.title", value: "Currency", comment: "") |
|
|
|
|
|
|
|
$0.options = viewModel.currency |
|
|
|
|
|
|
|
$0.value = config.currency.rawValue |
|
|
|
|
|
|
|
$0.displayValueFor = { value in |
|
|
|
|
|
|
|
return value |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}.onChange { row in |
|
|
|
|
|
|
|
guard let value = row.value else { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
self.config.currency = Currency(value: value) |
|
|
|
|
|
|
|
self.run(action: .currency) |
|
|
|
|
|
|
|
}.onPresent { _, selectorController in |
|
|
|
|
|
|
|
selectorController.enableDeselection = false |
|
|
|
|
|
|
|
}.cellSetup { cell, _ in |
|
|
|
|
|
|
|
cell.imageView?.image = R.image.settingsCurrency() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<<< AppFormAppearance.button { button in |
|
|
|
<<< AppFormAppearance.button { button in |
|
|
|
button.cellStyle = .value1 |
|
|
|
button.cellStyle = .value1 |
|
|
|
}.onCellSelection { [unowned self] _, _ in |
|
|
|
}.onCellSelection { [unowned self] _, _ in |
|
|
@ -111,6 +92,41 @@ class SettingsViewController: FormViewController { |
|
|
|
cell.accessoryType = .disclosureIndicator |
|
|
|
cell.accessoryType = .disclosureIndicator |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+++ Section() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<<< PushRow<Currency> { |
|
|
|
|
|
|
|
$0.title = viewModel.currencyTitle |
|
|
|
|
|
|
|
$0.selectorTitle = viewModel.currencyTitle |
|
|
|
|
|
|
|
$0.options = viewModel.currency |
|
|
|
|
|
|
|
$0.value = config.currency |
|
|
|
|
|
|
|
$0.displayValueFor = { value in |
|
|
|
|
|
|
|
return value?.rawValue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}.onChange { row in |
|
|
|
|
|
|
|
guard let value = row.value else { return } |
|
|
|
|
|
|
|
self.config.currency = value |
|
|
|
|
|
|
|
self.run(action: .currency) |
|
|
|
|
|
|
|
}.onPresent { _, selectorController in |
|
|
|
|
|
|
|
selectorController.enableDeselection = false |
|
|
|
|
|
|
|
selectorController.sectionKeyForValue = { option in |
|
|
|
|
|
|
|
switch option { |
|
|
|
|
|
|
|
case .USD, .EUR, .GBP, .AUD, .RUB: return Values.currencyPopularKey |
|
|
|
|
|
|
|
default: return Values.currencyAllKey |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
selectorController.sectionHeaderTitleForKey = { option in |
|
|
|
|
|
|
|
switch option { |
|
|
|
|
|
|
|
case Values.currencyPopularKey: |
|
|
|
|
|
|
|
return NSLocalizedString("settings.currency.popular.label.title", value: "Popular", comment: "") |
|
|
|
|
|
|
|
case Values.currencyAllKey: |
|
|
|
|
|
|
|
return NSLocalizedString("settings.currency.all.label.title", value: "All", comment: "") |
|
|
|
|
|
|
|
default: return "" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}.cellSetup { cell, _ in |
|
|
|
|
|
|
|
cell.imageView?.image = R.image.settingsCurrency() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
+++ Section(NSLocalizedString("settings.security.label.title", value: "Security", comment: "")) |
|
|
|
+++ Section(NSLocalizedString("settings.security.label.title", value: "Security", comment: "")) |
|
|
|
|
|
|
|
|
|
|
|
<<< SwitchRow { |
|
|
|
<<< SwitchRow { |
|
|
|