Merge pull request #364 from James-Sangalli/merge-settings-and-advanced-settings

Merge Settings and Advanced Settings
pull/370/head
James Sangalli 7 years ago committed by GitHub
commit 95099e5290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      Trust.xcodeproj/project.pbxproj
  2. 1
      Trust/Localization/en.lproj/Localizable.strings
  3. 1
      Trust/Localization/es.lproj/Localizable.strings
  4. 1
      Trust/Localization/zh-Hans.lproj/Localizable.strings
  5. 104
      Trust/Settings/ViewControllers/AdvancedSettingsViewController.swift
  6. 67
      Trust/Settings/ViewControllers/SettingsViewController.swift
  7. 39
      Trust/Settings/ViewModels/AdvancedSettingsViewModel.swift
  8. 4
      Trust/Settings/ViewModels/SettingsViewModel.swift

@ -288,7 +288,6 @@
5E7C71DAA5DAFF764F92587D /* SetTransferTicketsExpiryDateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C727433F7B8E322B3C68A /* SetTransferTicketsExpiryDateViewController.swift */; }; 5E7C71DAA5DAFF764F92587D /* SetTransferTicketsExpiryDateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C727433F7B8E322B3C68A /* SetTransferTicketsExpiryDateViewController.swift */; };
5E7C71F8050CCF990539B293 /* LockView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C79D674D45A07E694CE31 /* LockView.swift */; }; 5E7C71F8050CCF990539B293 /* LockView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C79D674D45A07E694CE31 /* LockView.swift */; };
5E7C7208A83399C27AE57E44 /* ImportWalletHelpBubbleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C70CC85B337061151724E /* ImportWalletHelpBubbleView.swift */; }; 5E7C7208A83399C27AE57E44 /* ImportWalletHelpBubbleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C70CC85B337061151724E /* ImportWalletHelpBubbleView.swift */; };
5E7C7248A9A732452BDC27D7 /* AdvancedSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C78581AA28CA5C3CBC468 /* AdvancedSettingsViewController.swift */; };
5E7C72670E16AFB8DAF64673 /* OnboardingPageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7E24936CC2190D2A16C2 /* OnboardingPageViewModel.swift */; }; 5E7C72670E16AFB8DAF64673 /* OnboardingPageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7E24936CC2190D2A16C2 /* OnboardingPageViewModel.swift */; };
5E7C728CDF33FBDBA47F71A6 /* MarketplaceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C794F8EBAEE5E8F2821C2 /* MarketplaceViewController.swift */; }; 5E7C728CDF33FBDBA47F71A6 /* MarketplaceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C794F8EBAEE5E8F2821C2 /* MarketplaceViewController.swift */; };
5E7C72AF95DCE8BC65490BCA /* StatusViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7B82CC07F290B9CAA4E4 /* StatusViewController.swift */; }; 5E7C72AF95DCE8BC65490BCA /* StatusViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7B82CC07F290B9CAA4E4 /* StatusViewController.swift */; };
@ -356,7 +355,6 @@
5E7C7B3E08EEA63C5B68B9C4 /* TicketRedemptionInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C778F20D32B70D7FF2135 /* TicketRedemptionInfoViewController.swift */; }; 5E7C7B3E08EEA63C5B68B9C4 /* TicketRedemptionInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C778F20D32B70D7FF2135 /* TicketRedemptionInfoViewController.swift */; };
5E7C7C0FAC500A6651E663FD /* TransferTicketsQuantitySelectionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C703BA1D0E9ACB7399155 /* TransferTicketsQuantitySelectionViewModel.swift */; }; 5E7C7C0FAC500A6651E663FD /* TransferTicketsQuantitySelectionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C703BA1D0E9ACB7399155 /* TransferTicketsQuantitySelectionViewModel.swift */; };
5E7C7C21E5CAF122AA4F6617 /* HowDoIGetMyMoneyInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C78B001F9F95F404D5FEF /* HowDoIGetMyMoneyInfoViewController.swift */; }; 5E7C7C21E5CAF122AA4F6617 /* HowDoIGetMyMoneyInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C78B001F9F95F404D5FEF /* HowDoIGetMyMoneyInfoViewController.swift */; };
5E7C7C658D619C70F1E3DE59 /* AdvancedSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C719B717E002583B1E2E9 /* AdvancedSettingsViewModel.swift */; };
5E7C7C7142C4519873B2BB4E /* ImportWalletTabBarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7C2872E213BBB05D55BA /* ImportWalletTabBarViewModel.swift */; }; 5E7C7C7142C4519873B2BB4E /* ImportWalletTabBarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7C2872E213BBB05D55BA /* ImportWalletTabBarViewModel.swift */; };
5E7C7C98EAF40E8110241DBD /* TicketTokenViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C783E3ADA4CF9554A0E7D /* TicketTokenViewCell.swift */; }; 5E7C7C98EAF40E8110241DBD /* TicketTokenViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C783E3ADA4CF9554A0E7D /* TicketTokenViewCell.swift */; };
5E7C7C9E89056069C8FEFA76 /* AlphaWalletSettingsSwitchRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7534FB6BF4D199643246 /* AlphaWalletSettingsSwitchRow.swift */; }; 5E7C7C9E89056069C8FEFA76 /* AlphaWalletSettingsSwitchRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7534FB6BF4D199643246 /* AlphaWalletSettingsSwitchRow.swift */; };
@ -809,7 +807,6 @@
5E7C7103135DCCCAB96EE5FC /* OnboardingPage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingPage.swift; sourceTree = "<group>"; }; 5E7C7103135DCCCAB96EE5FC /* OnboardingPage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingPage.swift; sourceTree = "<group>"; };
5E7C715F395B973FB61056CF /* HelpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HelpViewController.swift; sourceTree = "<group>"; }; 5E7C715F395B973FB61056CF /* HelpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HelpViewController.swift; sourceTree = "<group>"; };
5E7C71684B93F60206992E10 /* AlphaWalletSettingsTextRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AlphaWalletSettingsTextRow.swift; path = Views/AlphaWalletSettingsTextRow.swift; sourceTree = "<group>"; }; 5E7C71684B93F60206992E10 /* AlphaWalletSettingsTextRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AlphaWalletSettingsTextRow.swift; path = Views/AlphaWalletSettingsTextRow.swift; sourceTree = "<group>"; };
5E7C719B717E002583B1E2E9 /* AdvancedSettingsViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvancedSettingsViewModel.swift; sourceTree = "<group>"; };
5E7C71CE10548877F1124BF2 /* WelcomeViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WelcomeViewModel.swift; sourceTree = "<group>"; }; 5E7C71CE10548877F1124BF2 /* WelcomeViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WelcomeViewModel.swift; sourceTree = "<group>"; };
5E7C71EBD4C95AD4E11F3352 /* AlphaWalletSettingsButtonRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AlphaWalletSettingsButtonRow.swift; path = Views/AlphaWalletSettingsButtonRow.swift; sourceTree = "<group>"; }; 5E7C71EBD4C95AD4E11F3352 /* AlphaWalletSettingsButtonRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AlphaWalletSettingsButtonRow.swift; path = Views/AlphaWalletSettingsButtonRow.swift; sourceTree = "<group>"; };
5E7C72142D5817EF8FA8CADA /* PrivacyPolicyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivacyPolicyViewController.swift; sourceTree = "<group>"; }; 5E7C72142D5817EF8FA8CADA /* PrivacyPolicyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivacyPolicyViewController.swift; sourceTree = "<group>"; };
@ -859,7 +856,6 @@
5E7C7821694C489D5114DB18 /* TicketsViewControllerTitleHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TicketsViewControllerTitleHeader.swift; sourceTree = "<group>"; }; 5E7C7821694C489D5114DB18 /* TicketsViewControllerTitleHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TicketsViewControllerTitleHeader.swift; sourceTree = "<group>"; };
5E7C7828BD821B6F04B71C00 /* SendHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendHeaderView.swift; sourceTree = "<group>"; }; 5E7C7828BD821B6F04B71C00 /* SendHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendHeaderView.swift; sourceTree = "<group>"; };
5E7C783E3ADA4CF9554A0E7D /* TicketTokenViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TicketTokenViewCell.swift; sourceTree = "<group>"; }; 5E7C783E3ADA4CF9554A0E7D /* TicketTokenViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TicketTokenViewCell.swift; sourceTree = "<group>"; };
5E7C78581AA28CA5C3CBC468 /* AdvancedSettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvancedSettingsViewController.swift; sourceTree = "<group>"; };
5E7C78B001F9F95F404D5FEF /* HowDoIGetMyMoneyInfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HowDoIGetMyMoneyInfoViewController.swift; sourceTree = "<group>"; }; 5E7C78B001F9F95F404D5FEF /* HowDoIGetMyMoneyInfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HowDoIGetMyMoneyInfoViewController.swift; sourceTree = "<group>"; };
5E7C78B63FDE2FAF25389260 /* TransferTicketsViaWalletAddressViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTicketsViaWalletAddressViewController.swift; sourceTree = "<group>"; }; 5E7C78B63FDE2FAF25389260 /* TransferTicketsViaWalletAddressViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTicketsViaWalletAddressViewController.swift; sourceTree = "<group>"; };
5E7C793E23E2364B73C4D813 /* WelcomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = "<group>"; }; 5E7C793E23E2364B73C4D813 /* WelcomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = "<group>"; };
@ -1744,7 +1740,6 @@
298542F21FBD594D00CB5081 /* SettingsViewModel.swift */, 298542F21FBD594D00CB5081 /* SettingsViewModel.swift */,
7721A6CD202EFC21004DB16C /* AddCustomNetworkViewModel.swift */, 7721A6CD202EFC21004DB16C /* AddCustomNetworkViewModel.swift */,
771A847420322FD700528D28 /* PreferencesViewModel.swift */, 771A847420322FD700528D28 /* PreferencesViewModel.swift */,
5E7C719B717E002583B1E2E9 /* AdvancedSettingsViewModel.swift */,
5E7C7FCE2427A30ACD860DF8 /* ServerViewModel.swift */, 5E7C7FCE2427A30ACD860DF8 /* ServerViewModel.swift */,
5E7C7CBEBF984CFCA29D6866 /* ServersViewModel.swift */, 5E7C7CBEBF984CFCA29D6866 /* ServersViewModel.swift */,
5E7C7FB99843529061368DA1 /* LocalesViewModel.swift */, 5E7C7FB99843529061368DA1 /* LocalesViewModel.swift */,
@ -2162,7 +2157,6 @@
29F1C85C2003698A003780D8 /* WellDoneViewController.swift */, 29F1C85C2003698A003780D8 /* WellDoneViewController.swift */,
7721A6CB202EFBC5004DB16C /* AddCustomNetworkViewController.swift */, 7721A6CB202EFBC5004DB16C /* AddCustomNetworkViewController.swift */,
771A847220322F2500528D28 /* PreferencesViewController.swift */, 771A847220322F2500528D28 /* PreferencesViewController.swift */,
5E7C78581AA28CA5C3CBC468 /* AdvancedSettingsViewController.swift */,
5E7C7AFE9AF9FE6B58C925D4 /* SettingsViewController.swift */, 5E7C7AFE9AF9FE6B58C925D4 /* SettingsViewController.swift */,
5E7C74C0C1803DD17FE9EBA7 /* ServersViewController.swift */, 5E7C74C0C1803DD17FE9EBA7 /* ServersViewController.swift */,
5E7C7BF09AD68C113D58344C /* LocalesViewController.swift */, 5E7C7BF09AD68C113D58344C /* LocalesViewController.swift */,
@ -3577,8 +3571,6 @@
5E7C7AB6950E43BD6E8D0CBE /* TokensViewController.swift in Sources */, 5E7C7AB6950E43BD6E8D0CBE /* TokensViewController.swift in Sources */,
5E7C7FC0770A411DB09F8C09 /* TokenViewCell.swift in Sources */, 5E7C7FC0770A411DB09F8C09 /* TokenViewCell.swift in Sources */,
5E7C7CF43176653FFCE86644 /* SettingsCoordinator.swift in Sources */, 5E7C7CF43176653FFCE86644 /* SettingsCoordinator.swift in Sources */,
5E7C7248A9A732452BDC27D7 /* AdvancedSettingsViewController.swift in Sources */,
5E7C7C658D619C70F1E3DE59 /* AdvancedSettingsViewModel.swift in Sources */,
5E7C70FF17622C0FFD45A542 /* AlphaWalletSettingPushRow.swift in Sources */, 5E7C70FF17622C0FFD45A542 /* AlphaWalletSettingPushRow.swift in Sources */,
5E7C7C9E89056069C8FEFA76 /* AlphaWalletSettingsSwitchRow.swift in Sources */, 5E7C7C9E89056069C8FEFA76 /* AlphaWalletSettingsSwitchRow.swift in Sources */,
5E7C731B88842C036A74A039 /* AlphaWalletSettingsButtonRow.swift in Sources */, 5E7C731B88842C036A74A039 /* AlphaWalletSettingsButtonRow.swift in Sources */,

@ -223,7 +223,6 @@
"a.welcome.onboarding.2" = "Powered by blockchain technology, smart tickets, fraud free"; "a.welcome.onboarding.2" = "Powered by blockchain technology, smart tickets, fraud free";
"a.welcome.onboarding.3" = "Buy, sell and transfer your favourite tokens"; "a.welcome.onboarding.3" = "Buy, sell and transfer your favourite tokens";
"a.welcome.onboarding.createwallet.button.title" = "GET STARTED"; "a.welcome.onboarding.createwallet.button.title" = "GET STARTED";
"a.settings.advanced.label.title" = "Advanced";
"a.marketplace.tabbar.item.title" = "Marketplace"; "a.marketplace.tabbar.item.title" = "Marketplace";
"a.claim.ticket.title" = "Importing tickets"; "a.claim.ticket.title" = "Importing tickets";
"a.claim.ticket.prompt" = "Import Link?"; "a.claim.ticket.prompt" = "Import Link?";

@ -223,7 +223,6 @@
"a.welcome.onboarding.2" = "Powered by blockchain technology, smart tickets, fraud free"; "a.welcome.onboarding.2" = "Powered by blockchain technology, smart tickets, fraud free";
"a.welcome.onboarding.3" = "Buy, sell and transfer your favourite tokens"; "a.welcome.onboarding.3" = "Buy, sell and transfer your favourite tokens";
"a.welcome.onboarding.createwallet.button.title" = "GET STARTED"; "a.welcome.onboarding.createwallet.button.title" = "GET STARTED";
"a.settings.advanced.label.title" = "Advanced";
"a.marketplace.tabbar.item.title" = "Marketplace"; "a.marketplace.tabbar.item.title" = "Marketplace";
"a.claim.ticket.title" = "Importing tickets"; "a.claim.ticket.title" = "Importing tickets";
"a.claim.ticket.prompt" = "Import Link?"; "a.claim.ticket.prompt" = "Import Link?";

@ -223,7 +223,6 @@
"a.welcome.onboarding.2" = "基于区块链技术,智能门票,杜绝欺诈"; "a.welcome.onboarding.2" = "基于区块链技术,智能门票,杜绝欺诈";
"a.welcome.onboarding.3" = "买,卖,转让各种token"; "a.welcome.onboarding.3" = "买,卖,转让各种token";
"a.welcome.onboarding.createwallet.button.title" = "开始使用"; "a.welcome.onboarding.createwallet.button.title" = "开始使用";
"a.settings.advanced.label.title" = "高级设置";
"a.marketplace.tabbar.item.title" = "公共市场"; "a.marketplace.tabbar.item.title" = "公共市场";
"a.claim.ticket.title" = "导入门票"; "a.claim.ticket.title" = "导入门票";
"a.claim.ticket.prompt" = "导入门票?"; "a.claim.ticket.prompt" = "导入门票?";

@ -1,104 +0,0 @@
// Copyright © 2018 Stormbird PTE. LTD.
import Foundation
import UIKit
import Eureka
protocol AdvancedSettingsViewControllerDelegate: class {
func didAction(action: AlphaWalletSettingsAction, in viewController: AdvancedSettingsViewController)
}
class AdvancedSettingsViewController: FormViewController {
private var account: Wallet
private var config: Config
weak var delegate: AdvancedSettingsViewControllerDelegate?
let viewModel = AdvancedSettingsViewModel()
init(
account: Wallet,
config: Config
) {
self.account = account
self.config = config
super.init(nibName: nil, bundle: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = Colors.appBackground
tableView.separatorStyle = .none
tableView.backgroundColor = Colors.appBackground
navigationItem.title = viewModel.title
form +++ Section()
<<< AppFormAppearance.alphaWalletSettingsButton { button in
button.cellStyle = .value1
}.onCellSelection { [unowned self] _, _ in
self.run(action: .servers)
}.cellSetup { cell, _ in
cell.imageView?.tintColor = Colors.appBackground
}.cellUpdate { [weak self] cell, _ in
guard let strongSelf = self else {
return
}
cell.imageView?.image = R.image.settings_server()?.withRenderingMode(.alwaysTemplate)
cell.textLabel?.text = R.string.localizable.settingsNetworkButtonTitle()
cell.detailTextLabel?.text = RPCServer(chainID: strongSelf.config.chainID).displayName
cell.accessoryType = .disclosureIndicator
}
<<< AppFormAppearance.alphaWalletSettingsButton { button in
button.cellStyle = .value1
}.onCellSelection { [unowned self] _, _ in
self.run(action: .wallets)
}.cellSetup { cell, _ in
cell.imageView?.tintColor = Colors.appBackground
}.cellUpdate { cell, _ in
cell.imageView?.image = R.image.settings_wallet()?.withRenderingMode(.alwaysTemplate)
cell.textLabel?.text = R.string.localizable.settingsWalletsButtonTitle()
cell.detailTextLabel?.text = String(self.account.address.description.prefix(10)) + "..."
cell.accessoryType = .disclosureIndicator
}
<<< AppFormAppearance.alphaWalletSettingsButton { button in
button.cellStyle = .value1
}.onCellSelection { [unowned self] _, _ in
self.run(action: .locales)
}.cellSetup { cell, _ in
cell.imageView?.tintColor = Colors.appBackground
}.cellUpdate { [weak self] cell, _ in
guard let strongSelf = self else {
return
}
cell.imageView?.image = R.image.settings_language()?.withRenderingMode(.alwaysTemplate)
cell.textLabel?.text = strongSelf.viewModel.localeTitle
cell.detailTextLabel?.text = AppLocale(id: strongSelf.config.locale).displayName
cell.accessoryType = .disclosureIndicator
}
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func run(action: AlphaWalletSettingsAction) {
delegate?.didAction(action: action, in: self)
}
override open func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let v = UIView()
v.backgroundColor = Colors.appBackground
return v
}
override open func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let v = UIView()
v.backgroundColor = Colors.appBackground
return v
}
}

@ -47,6 +47,51 @@ class SettingsViewController: FormViewController {
cell.accessoryType = .disclosureIndicator cell.accessoryType = .disclosureIndicator
} }
<<< AppFormAppearance.alphaWalletSettingsButton { button in
button.cellStyle = .value1
}.onCellSelection { [unowned self] _, _ in
self.run(action: .wallets)
}.cellSetup { cell, _ in
cell.imageView?.tintColor = Colors.appBackground
}.cellUpdate { cell, _ in
cell.imageView?.image = R.image.settings_wallet()?.withRenderingMode(.alwaysTemplate)
cell.textLabel?.text = R.string.localizable.settingsWalletsButtonTitle()
cell.detailTextLabel?.text = String(self.session.account.address.description.prefix(10)) + "..."
cell.accessoryType = .disclosureIndicator
}
<<< AppFormAppearance.alphaWalletSettingsButton { button in
button.cellStyle = .value1
}.onCellSelection { [unowned self] _, _ in
self.run(action: .servers)
}.cellSetup { cell, _ in
cell.imageView?.tintColor = Colors.appBackground
}.cellUpdate { [weak self] cell, _ in
guard let strongSelf = self else {
return
}
cell.imageView?.image = R.image.settings_server()?.withRenderingMode(.alwaysTemplate)
cell.textLabel?.text = R.string.localizable.settingsNetworkButtonTitle()
cell.detailTextLabel?.text = RPCServer(chainID: strongSelf.config.chainID).displayName
cell.accessoryType = .disclosureIndicator
}
<<< AppFormAppearance.alphaWalletSettingsButton { button in
button.cellStyle = .value1
}.onCellSelection { [unowned self] _, _ in
self.run(action: .locales)
}.cellSetup { cell, _ in
cell.imageView?.tintColor = Colors.appBackground
}.cellUpdate { [weak self] cell, _ in
guard let strongSelf = self else {
return
}
cell.imageView?.image = R.image.settings_language()?.withRenderingMode(.alwaysTemplate)
cell.textLabel?.text = strongSelf.viewModel.localeTitle
cell.detailTextLabel?.text = AppLocale(id: strongSelf.config.locale).displayName
cell.accessoryType = .disclosureIndicator
}
<<< AlphaWalletSettingsSwitchRow { [weak self] in <<< AlphaWalletSettingsSwitchRow { [weak self] in
$0.title = self?.viewModel.passcodeTitle $0.title = self?.viewModel.passcodeTitle
$0.value = self?.isPasscodeEnabled $0.value = self?.isPasscodeEnabled
@ -83,21 +128,6 @@ class SettingsViewController: FormViewController {
+++ Section() +++ Section()
<<< AppFormAppearance.alphaWalletSettingsButton { row in
row.cellStyle = .value1
row.presentationMode = .show(controllerProvider: ControllerProvider<UIViewController>.callback {
let vc = AdvancedSettingsViewController(account: account, config: self.config)
vc.delegate = self
return vc }, onDismiss: { _ in
})
}.cellSetup { cell, _ in
cell.imageView?.tintColor = Colors.appBackground
}.cellUpdate { cell, _ in
cell.imageView?.image = R.image.settings_preferences()?.withRenderingMode(.alwaysTemplate)
cell.textLabel?.text = R.string.localizable.aSettingsAdvancedLabelTitle()
cell.accessoryType = .disclosureIndicator
}
<<< AlphaWalletSettingsTextRow { <<< AlphaWalletSettingsTextRow {
$0.disabled = true $0.disabled = true
}.cellSetup { cell, _ in }.cellSetup { cell, _ in
@ -159,10 +189,3 @@ class SettingsViewController: FormViewController {
return 0 return 0
} }
} }
extension SettingsViewController: AdvancedSettingsViewControllerDelegate {
func didAction(action: AlphaWalletSettingsAction, in viewController: AdvancedSettingsViewController) {
run(action: action)
}
}

@ -1,39 +0,0 @@
// Copyright © 2018 Stormbird PTE. LTD.
import Foundation
struct AdvancedSettingsViewModel {
var title: String {
return R.string.localizable.aSettingsAdvancedLabelTitle()
}
var showTokensTabTitle: String {
return R.string.localizable.settingsPreferencesButtonTitle()
}
var showTokensTabOnStart: Bool {
return true
}
var networkTitle: String {
return R.string.localizable.settingsNetworkButtonTitle()
}
var servers: [RPCServer] {
return [
RPCServer.main,
RPCServer.classic,
RPCServer.poa,
// RPCServer.callisto, TODO: Enable.
RPCServer.kovan,
RPCServer.ropsten,
RPCServer.rinkeby,
RPCServer.sokol,
]
}
var localeTitle: String {
return R.string.localizable.settingsLanguageButtonTitle()
}
}

@ -45,4 +45,8 @@ struct SettingsViewModel {
var currencyTitle: String { var currencyTitle: String {
return R.string.localizable.settingsCurrencyButtonTitle() return R.string.localizable.settingsCurrencyButtonTitle()
} }
var localeTitle: String {
return R.string.localizable.settingsLanguageButtonTitle()
}
} }

Loading…
Cancel
Save