Remove unused code for custom networks

pull/950/head
Hwee-Boon Yar 6 years ago
parent dfa2cecc2a
commit 024e3e371d
  1. 12
      AlphaWallet.xcodeproj/project.pbxproj
  2. 2
      AlphaWallet/Localization/en.lproj/Localizable.strings
  3. 2
      AlphaWallet/Localization/es.lproj/Localizable.strings
  4. 2
      AlphaWallet/Localization/ja.lproj/Localizable.strings
  5. 2
      AlphaWallet/Localization/ko.lproj/Localizable.strings
  6. 2
      AlphaWallet/Localization/zh-Hans.lproj/Localizable.strings
  7. 52
      AlphaWallet/Settings/Coordinators/AddCustomNetworkCoordinator.swift
  8. 85
      AlphaWallet/Settings/ViewControllers/AddCustomNetworkViewController.swift
  9. 9
      AlphaWallet/Settings/ViewModels/AddCustomNetworkViewModel.swift

@ -512,9 +512,6 @@
771AA966200D5F1900D25403 /* WordCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 771AA965200D5F1900D25403 /* WordCollectionViewCell.xib */; };
7721A6BE202A5677004DB16C /* DecryptError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7721A6BD202A5677004DB16C /* DecryptError.swift */; };
7721A6C8202EF81B004DB16C /* CustomRPC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7721A6C7202EF81B004DB16C /* CustomRPC.swift */; };
7721A6CC202EFBC5004DB16C /* AddCustomNetworkViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7721A6CB202EFBC5004DB16C /* AddCustomNetworkViewController.swift */; };
7721A6CE202EFC21004DB16C /* AddCustomNetworkViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7721A6CD202EFC21004DB16C /* AddCustomNetworkViewModel.swift */; };
7721A6D0202EFD07004DB16C /* AddCustomNetworkCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7721A6CF202EFD07004DB16C /* AddCustomNetworkCoordinator.swift */; };
775C00B520195BFB001B5EBC /* BrowserAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 775C00B420195BFB001B5EBC /* BrowserAction.swift */; };
77872D232023F43B0032D687 /* TransactionsTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77872D222023F43B0032D687 /* TransactionsTracker.swift */; };
77872D25202505B70032D687 /* EnterPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77872D24202505B70032D687 /* EnterPasswordViewController.swift */; };
@ -1095,9 +1092,6 @@
7721A6BD202A5677004DB16C /* DecryptError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DecryptError.swift; sourceTree = "<group>"; };
7721A6BF202B1D3E004DB16C /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
7721A6C7202EF81B004DB16C /* CustomRPC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRPC.swift; sourceTree = "<group>"; };
7721A6CB202EFBC5004DB16C /* AddCustomNetworkViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddCustomNetworkViewController.swift; sourceTree = "<group>"; };
7721A6CD202EFC21004DB16C /* AddCustomNetworkViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddCustomNetworkViewModel.swift; sourceTree = "<group>"; };
7721A6CF202EFD07004DB16C /* AddCustomNetworkCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddCustomNetworkCoordinator.swift; sourceTree = "<group>"; };
775C00B420195BFB001B5EBC /* BrowserAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserAction.swift; sourceTree = "<group>"; };
77872D222023F43B0032D687 /* TransactionsTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionsTracker.swift; sourceTree = "<group>"; };
77872D24202505B70032D687 /* EnterPasswordViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnterPasswordViewController.swift; sourceTree = "<group>"; };
@ -1585,7 +1579,6 @@
isa = PBXGroup;
children = (
29F1C85920036968003780D8 /* HelpUsCoordinator.swift */,
7721A6CF202EFD07004DB16C /* AddCustomNetworkCoordinator.swift */,
5E7C7B1FB2702A2A8A4EBD76 /* SettingsCoordinator.swift */,
5E7C7B8FD1E2BCC325DF4EE4 /* ServersCoordinator.swift */,
5E7C76C895E7BFA47233068C /* LocalesCoordinator.swift */,
@ -1778,7 +1771,6 @@
children = (
29F1C85E200369BA003780D8 /* HelpUsViewModel.swift */,
298542F21FBD594D00CB5081 /* SettingsViewModel.swift */,
7721A6CD202EFC21004DB16C /* AddCustomNetworkViewModel.swift */,
5E7C7FCE2427A30ACD860DF8 /* ServerViewModel.swift */,
5E7C7CBEBF984CFCA29D6866 /* ServersViewModel.swift */,
5E7C7FB99843529061368DA1 /* LocalesViewModel.swift */,
@ -2195,7 +2187,6 @@
isa = PBXGroup;
children = (
29F1C85C2003698A003780D8 /* WellDoneViewController.swift */,
7721A6CB202EFBC5004DB16C /* AddCustomNetworkViewController.swift */,
5E7C7AFE9AF9FE6B58C925D4 /* SettingsViewController.swift */,
5E7C74C0C1803DD17FE9EBA7 /* ServersViewController.swift */,
5E7C7BF09AD68C113D58344C /* LocalesViewController.swift */,
@ -3601,7 +3592,6 @@
77B3BF3C201908ED00EEC15A /* ConfirmCoordinator.swift in Sources */,
298542F91FBE9A0100CB5081 /* CryptoAddressValidator.swift in Sources */,
291F52C11F6C8A1F00B369AB /* AccountsViewModel.swift in Sources */,
7721A6CC202EFBC5004DB16C /* AddCustomNetworkViewController.swift in Sources */,
77872D322027AA4A0032D687 /* SliderTextFieldRow.swift in Sources */,
2923D9B11FDA49D8000CF3F8 /* Initializer.swift in Sources */,
294DFBAE1FE6F254004CEB56 /* TokenObject.swift in Sources */,
@ -3670,7 +3660,6 @@
296AF9A91F737F6F0058AF78 /* SendRawTransactionRequest.swift in Sources */,
293112121FC4F48400966EEA /* ServiceProvider.swift in Sources */,
2912CD2F1F6A83A100C6CBE3 /* ImportWalletViewController.swift in Sources */,
7721A6D0202EFD07004DB16C /* AddCustomNetworkCoordinator.swift in Sources */,
2963B6AD1F981A96003063C1 /* TransactionAppearance.swift in Sources */,
29850D2B1F6B30FF00791A49 /* TransactionViewController.swift in Sources */,
296AF9AB1F7380920058AF78 /* GetTransactionCountRequest.swift in Sources */,
@ -3680,7 +3669,6 @@
298542F51FBD8E6A00CB5081 /* ConfigExplorer.swift in Sources */,
29DF400A1FD3E80A000077CA /* TabBarController.swift in Sources */,
29C80D4F1FB520AF0037B1E0 /* BalanceTokenViewModel.swift in Sources */,
7721A6CE202EFC21004DB16C /* AddCustomNetworkViewModel.swift in Sources */,
291A1B691F980E3400ADEC80 /* StackViewController.swift in Sources */,
73C41C73201B5EFF00243C6C /* LockCreatePasscodeViewModel.swift in Sources */,
29B6AED61F7CA4A700EC6DE3 /* TransactionConfiguration.swift in Sources */,

@ -290,8 +290,6 @@
"accounts.delete.error.failedToExportPrivateKey" = "Failed to export private key";
"Chain ID" = "Chain ID";
"Endpoint" = "Endpoint";
"settings.network.custom.label.title" = "Custom";
"settings.customNetwork.navigation.title" = "Custom Network";
"settings.preferences.button.title" = "Show Tokens on Launch";
"settings.preferences.title" = "Preferences";
"Balance" = "Balance";

@ -290,8 +290,6 @@
"accounts.delete.error.failedToExportPrivateKey" = "Error al exportar la clave privada";
"Chain ID" = "ID de cadena";
"Endpoint" = "Punto final";
"settings.network.custom.label.title" = "Personalizada";
"settings.customNetwork.navigation.title" = "Red personalizada";
"settings.preferences.button.title" = "Mostrar tokens al iniciar";
"settings.preferences.title" = "Preferencias";
"Balance" = "Saldo";

@ -290,8 +290,6 @@
"accounts.delete.error.failedToExportPrivateKey" = "秘密鍵をエクスポートできませんでした";
"Chain ID" = "チェーン ID";
"Endpoint" = "エンドポイント";
"settings.network.custom.label.title" = "カスタム";
"settings.customNetwork.navigation.title" = "カスタム ネットワーク";
"settings.preferences.button.title" = "起動時にトークンを表示";
"settings.preferences.title" = "基本設定";
"Balance" = "残高";

@ -290,8 +290,6 @@
"accounts.delete.error.failedToExportPrivateKey" = "개인 키를 내보내지 못했습니다";
"Chain ID" = "체인 ID";
"Endpoint" = "엔드포인트";
"settings.network.custom.label.title" = "사용자 정의";
"settings.customNetwork.navigation.title" = "사용자 정의 네트워크";
"settings.preferences.button.title" = "시작 시 토큰 표시";
"settings.preferences.title" = "환경 설정";
"Balance" = "잔고";

@ -290,8 +290,6 @@
"accounts.delete.error.failedToExportPrivateKey" = "导出私钥失败";
"Chain ID" = "Chain ID";
"Endpoint" = "端点";
"settings.network.custom.label.title" = "自定义";
"settings.customNetwork.navigation.title" = "自定义网络";
"settings.preferences.button.title" = "在开始页面显示 Token";
"settings.preferences.title" = "设置";
"Balance" = "余额";

@ -1,52 +0,0 @@
// Copyright SIX DAY LLC. All rights reserved.
import Foundation
import UIKit
protocol AddCustomNetworkCoordinatorDelegate: class {
func didAddNetwork(network: CustomRPC, in coordinator: AddCustomNetworkCoordinator)
func didCancel(in coordinator: AddCustomNetworkCoordinator)
}
class AddCustomNetworkCoordinator: Coordinator {
private let navigationController: UINavigationController
private lazy var addNetworkItem: UIBarButtonItem = {
return UIBarButtonItem(
barButtonSystemItem: .add,
target: self,
action: #selector(addNetwork)
)
}()
private lazy var addCustomNetworkController: AddCustomNetworkViewController = {
let controller = AddCustomNetworkViewController()
controller.navigationItem.rightBarButtonItem = addNetworkItem
return controller
}()
var coordinators: [Coordinator] = []
weak var delegate: AddCustomNetworkCoordinatorDelegate?
init(
navigationController: UINavigationController = NavigationController()
) {
self.navigationController = navigationController
self.navigationController.modalPresentationStyle = .formSheet
}
func start() {
navigationController.viewControllers = [addCustomNetworkController]
}
@objc func addNetwork() {
addCustomNetworkController.addNetwork { [weak self] result in
guard let strongSelf = self else { return }
switch result {
case .success(let network):
strongSelf.delegate?.didAddNetwork(network: network, in: strongSelf)
case .failure: break
}
}
}
}

@ -1,85 +0,0 @@
// Copyright SIX DAY LLC. All rights reserved.
import UIKit
import Eureka
import Result
class AddCustomNetworkViewController: FormViewController {
private let viewModel = AddCustomNetworkViewModel()
private struct Values {
static let chainID = "chainID"
static let name = "name"
static let symbol = "symbol"
static let endpoint = "endpoint"
}
private var chainIDRow: TextFloatLabelRow? {
return form.rowBy(tag: Values.chainID) as? TextFloatLabelRow
}
private var nameRow: TextFloatLabelRow? {
return form.rowBy(tag: Values.name) as? TextFloatLabelRow
}
private var symbolRow: TextFloatLabelRow? {
return form.rowBy(tag: Values.symbol) as? TextFloatLabelRow
}
private var endpointRow: TextFloatLabelRow? {
return form.rowBy(tag: Values.endpoint) as? TextFloatLabelRow
}
weak var delegate: NewTokenViewControllerDelegate?
override func viewDidLoad() {
super.viewDidLoad()
title = viewModel.title
form = Section()
+++ Section()
<<< AppFormAppearance.textFieldFloat(tag: Values.chainID) {
$0.add(rule: EthereumAddressRule())
$0.validationOptions = .validatesOnDemand
$0.title = R.string.localizable.chainID()
}.cellUpdate { cell, _ in
cell.textField.keyboardType = .decimalPad
}
<<< AppFormAppearance.textFieldFloat(tag: Values.name) {
$0.add(rule: RuleRequired())
$0.validationOptions = .validatesOnDemand
$0.title = R.string.localizable.name()
}
<<< AppFormAppearance.textFieldFloat(tag: Values.symbol) {
$0.add(rule: RuleRequired())
$0.validationOptions = .validatesOnDemand
$0.title = R.string.localizable.symbol()
}
<<< AppFormAppearance.textFieldFloat(tag: Values.endpoint) {
$0.add(rule: RuleRequired())
$0.validationOptions = .validatesOnDemand
$0.title = R.string.localizable.endpoint()
}
}
func addNetwork(completion: @escaping(Result<CustomRPC, AnyError>) -> Void) {
guard form.validate().isEmpty else {
return
}
let chainID = Int(chainIDRow?.value ?? "0") ?? 0
let name = nameRow?.value ?? ""
let symbol = symbolRow?.value ?? ""
let endpoint = endpointRow?.value ?? ""
let customNetwork = CustomRPC(
chainID: chainID,
name: name,
symbol: symbol,
endpoint: endpoint
)
completion(.success(customNetwork))
}
}

@ -1,9 +0,0 @@
// Copyright SIX DAY LLC. All rights reserved.
import Foundation
struct AddCustomNetworkViewModel {
var title: String {
return R.string.localizable.settingsCustomNetworkNavigationTitle()
}
}
Loading…
Cancel
Save