Make private properties private, reorganize properties order

pull/787/head
Hwee-Boon Yar 6 years ago
parent 7681224891
commit 6f7c9ca9db
  1. 8
      AlphaWallet.xcodeproj/project.pbxproj
  2. 2
      AlphaWallet/AlphaWalletHelp/ViewControllers/HelpContentsViewController.swift
  3. 7
      AlphaWallet/AlphaWalletHelp/Views/ContactUsBannerView.swift
  4. 6
      AlphaWallet/AlphaWalletHelp/Views/HelpViewCell.swift
  5. 4
      AlphaWallet/AssetDefinition/Views/AssetDefinitionsOverridesViewCell.swift
  6. 9
      AlphaWallet/AssetDefinition/XMLHandler.swift
  7. 50
      AlphaWallet/Browser/Coordinators/BrowserCoordinator.swift
  8. 4
      AlphaWallet/Browser/Storage/HistoryStore.swift
  9. 4
      AlphaWallet/Browser/Types/BrowserURLParser.swift
  10. 9
      AlphaWallet/Browser/ViewControllers/BookmarkViewController.swift
  11. 31
      AlphaWallet/Browser/ViewControllers/BrowserViewController.swift
  12. 7
      AlphaWallet/Browser/ViewControllers/HistoryViewController.swift
  13. 7
      AlphaWallet/Browser/ViewControllers/MasterBrowserViewController.swift
  14. 2
      AlphaWallet/Browser/ViewModel/BookmarkViewModel.swift
  15. 2
      AlphaWallet/Browser/ViewModel/BookmarksViewModel.swift
  16. 2
      AlphaWallet/Browser/ViewModel/HistoriesViewModel.swift
  17. 2
      AlphaWallet/Browser/ViewModel/HistoryViewModel.swift
  18. 9
      AlphaWallet/Browser/Views/BrowserErrorView.swift
  19. 14
      AlphaWallet/Browser/Views/BrowserNavigationBar.swift
  20. 11
      AlphaWallet/Core/Coordinators/CheckDeviceCoordinator.swift
  21. 2
      AlphaWallet/Core/Helpers/ScriptMessageProxy.swift
  22. 4
      AlphaWallet/Core/Initializers/MigrationInitializer.swift
  23. 2
      AlphaWallet/Core/Initializers/SkipBackupFilesInitializer.swift
  24. 8
      AlphaWallet/Core/ViewModels/GasViewModel.swift
  25. 3
      AlphaWallet/Core/ViewModels/InCoordinatorViewModel.swift
  26. 4
      AlphaWallet/Deposit/Coordinators/DepositCoordinator.swift
  27. 9
      AlphaWallet/EtherClient/CoinMarket/Types/CoinTicker.swift
  28. 7
      AlphaWallet/EtherClient/EtherKeystore.swift
  29. 2
      AlphaWallet/EtherClient/TransactionSigning.swift
  30. 4
      AlphaWallet/Export/Coordinators/BackupCoordinator.swift
  31. 3
      AlphaWallet/Export/Coordinators/PromptBackupCoordinator.swift
  32. 4
      AlphaWallet/Export/ViewControllers/BackUpViewController.swift
  33. 2
      AlphaWallet/Export/ViewModels/BackupViewModel.swift
  34. 26
      AlphaWallet/Lock/Views/LockView.swift
  35. 8
      AlphaWallet/Lock/Views/PasscodeCharacterView.swift
  36. 4
      AlphaWallet/Market/MarketQueueHandler.swift
  37. 30
      AlphaWallet/Market/ViewControllers/ImportMagicTokenViewController.swift
  38. 13
      AlphaWallet/Market/ViewControllers/StatusViewController.swift
  39. 2
      AlphaWallet/Market/ViewModels/ImportMagicTokenCardRowViewModel.swift
  40. 8
      AlphaWallet/Market/ViewModels/StatusViewControllerViewModel.swift
  41. 2
      AlphaWallet/MarketPlace/ViewControllers/MarketplaceViewController.swift
  42. 12
      AlphaWallet/Protection/Coordinators/ProtectionCoordinator.swift
  43. 6
      AlphaWallet/Protection/Coordinators/SplashCoordinator.swift
  44. 1
      AlphaWallet/Protection/ViewControllers/SplashViewController.swift
  45. 1
      AlphaWallet/Protection/Views/SplashView.swift
  46. 1
      AlphaWallet/Redeem/Helpers/RedeemEventListener.swift
  47. 1
      AlphaWallet/Redeem/Helpers/SignatureHelper.swift
  48. 1
      AlphaWallet/Redeem/Rest/EventsRest.swift
  49. 16
      AlphaWallet/Redeem/ViewControllers/RedeemTokenCardQuantitySelectionViewController.swift
  50. 12
      AlphaWallet/Redeem/ViewControllers/RedeemTokenViewController.swift
  51. 16
      AlphaWallet/Redeem/ViewControllers/TokenCardRedemptionViewController.swift
  52. 5
      AlphaWallet/Redeem/ViewModels/RedeemTokenCardQuantitySelectionViewModel.swift
  53. 5
      AlphaWallet/Redeem/ViewModels/RedeemTokenCardViewModel.swift
  54. 4
      AlphaWallet/Redeem/ViewModels/TokenCardRedemptionViewModel.swift
  55. 1
      AlphaWallet/Rest/RestClient.swift
  56. 48
      AlphaWallet/Sell/ViewControllers/EnterSellTokensCardPriceQuantityViewController.swift
  57. 23
      AlphaWallet/Sell/ViewControllers/GenerateSellMagicLinkViewController.swift
  58. 10
      AlphaWallet/Sell/ViewControllers/SellTokensCardViewController.swift
  59. 44
      AlphaWallet/Sell/ViewControllers/SetSellTokensCardExpiryDateViewController.swift
  60. 5
      AlphaWallet/Sell/ViewModels/EnterSellTokensCardPriceQuantityViewControllerViewModel.swift
  61. 6
      AlphaWallet/Sell/ViewModels/GenerateSellMagicLinkViewControllerViewModel.swift
  62. 4
      AlphaWallet/Sell/ViewModels/GenerateTransferMagicLinkViewControllerViewModel.swift
  63. 5
      AlphaWallet/Sell/ViewModels/SellTokensCardViewModel.swift
  64. 6
      AlphaWallet/Sell/ViewModels/SetSellTokensCardExpiryDateViewControllerViewModel.swift
  65. 3
      AlphaWallet/Sell/Views/DateEntryField.swift
  66. 3
      AlphaWallet/Sell/Views/TimeEntryField.swift
  67. 11
      AlphaWallet/Settings/Coordinators/AddCustomNetworkCoordinator.swift
  68. 6
      AlphaWallet/Settings/Coordinators/HelpUsCoordinator.swift
  69. 3
      AlphaWallet/Settings/Coordinators/LocalesCoordinator.swift
  70. 3
      AlphaWallet/Settings/Coordinators/ServersCoordinator.swift
  71. 8
      AlphaWallet/Settings/Coordinators/SettingsCoordinator.swift
  72. 1
      AlphaWallet/Settings/Types/Config.swift
  73. 3
      AlphaWallet/Settings/Types/ConfigExplorer.swift
  74. 7
      AlphaWallet/Settings/ViewControllers/AddCustomNetworkViewController.swift
  75. 11
      AlphaWallet/Settings/ViewControllers/LocalesViewController.swift
  76. 3
      AlphaWallet/Settings/ViewControllers/PreferencesController.swift
  77. 11
      AlphaWallet/Settings/ViewControllers/ServersViewController.swift
  78. 12
      AlphaWallet/Settings/ViewControllers/SettingsViewController.swift
  79. 1
      AlphaWallet/Settings/ViewControllers/WellDoneViewController.swift
  80. 1
      AlphaWallet/Settings/ViewModels/AddCustomNetworkViewModel.swift
  81. 1
      AlphaWallet/Settings/ViewModels/HelpUsViewModel.swift
  82. 4
      AlphaWallet/Settings/ViewModels/LocaleViewModel.swift
  83. 4
      AlphaWallet/Settings/ViewModels/ServerViewModel.swift
  84. 3
      AlphaWallet/Settings/ViewModels/ServersViewModel.swift
  85. 18
      AlphaWallet/Settings/ViewModels/SettingsViewModel.swift
  86. 2
      AlphaWallet/Settings/Views/AlphaWalletSettingsSwitchRow.swift
  87. 3
      AlphaWallet/Settings/Views/AlphaWalletSettingsTextRow.swift
  88. 6
      AlphaWallet/Settings/Views/LocaleViewCell.swift
  89. 6
      AlphaWallet/Settings/Views/ServerViewCell.swift
  90. 4
      AlphaWallet/Tokens/Coordinators/ClaimOrderCoordinator.swift
  91. 1
      AlphaWallet/Tokens/Coordinators/GetBalanceCoordinator.swift
  92. 1
      AlphaWallet/Tokens/Coordinators/GetDecimalsCoordinator.swift
  93. 1
      AlphaWallet/Tokens/Coordinators/GetNameCoordinator.swift
  94. 1
      AlphaWallet/Tokens/Coordinators/GetSymbolCoordinator.swift
  95. 14
      AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift
  96. 3
      AlphaWallet/Tokens/Helpers/TokenAdaptor.swift
  97. 4
      AlphaWallet/Tokens/Types/Token.swift
  98. 1
      AlphaWallet/Tokens/Types/TokenBalance.swift
  99. 22
      AlphaWallet/Tokens/Types/TokenHolder.swift
  100. 7
      AlphaWallet/Tokens/Types/TokenObject.swift
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1899,7 +1899,6 @@
isa = PBXGroup;
children = (
29E6E06F1FEA12910079265A /* TransactionConfigurator.swift */,
5E7C7A5A98CE71365B6E80FF /* Views */,
);
path = Controllers;
sourceTree = "<group>";
@ -2630,13 +2629,6 @@
path = ViewModels;
sourceTree = "<group>";
};
5E7C7A5A98CE71365B6E80FF /* Views */ = {
isa = PBXGroup;
children = (
);
path = Views;
sourceTree = "<group>";
};
5E7C7A968681D718C8A32B47 /* Commands */ = {
isa = PBXGroup;
children = (

@ -3,7 +3,7 @@
import UIKit
class HelpContentsViewController: StaticHTMLViewController {
let banner = ContactUsBannerView()
private let banner = ContactUsBannerView()
override init(delegate: StaticHTMLViewControllerDelegate?) {
super.init(delegate: delegate)

@ -8,10 +8,11 @@ protocol ContactUsBannerViewDelegate: class {
}
class ContactUsBannerView: UIView {
private let button = UIButton(type: .system)
private let imageView = UIImageView()
private let label = UILabel()
weak var delegate: ContactUsBannerViewDelegate?
let button = UIButton(type: .system)
let imageView = UIImageView()
let label = UILabel()
let bannerHeight = CGFloat(60)
override init(frame: CGRect) {

@ -5,9 +5,9 @@ import UIKit
class HelpViewCell: UITableViewCell {
static let identifier = "HelpViewCell"
let background = UIView()
let titleLabel = UILabel()
let iconImageView = UIImageView()
private let background = UIView()
private let titleLabel = UILabel()
private let iconImageView = UIImageView()
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

@ -5,8 +5,8 @@ import UIKit
class AssetDefinitionsOverridesViewCell: UITableViewCell {
static let identifier = "AssetDefinitionsOverridesViewCell"
let background = UIView()
let titleLabel = UILabel()
private let background = UIView()
private let titleLabel = UILabel()
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

@ -24,11 +24,10 @@ enum TitlecaseOrNot {
private class PrivateXMLHandler {
private let xml: XML.Accessor
let contractAddress: String
lazy var contract = xml["token"]["contract"].getElement(attributeName: "type", attributeValue: "holding", fallbackToFirst: true)
lazy var fields = extractFields()
private let contractAddress: String
private lazy var contract = xml["token"]["contract"].getElement(attributeName: "type", attributeValue: "holding", fallbackToFirst: true)
private lazy var fields = extractFields()
private let isOfficial: Bool
let hasAssetDefinition: Bool
private let signatureNamespace: String
private var signatureNamespacePrefix: String {
if signatureNamespace.isEmpty {
@ -38,6 +37,8 @@ private class PrivateXMLHandler {
}
}
let hasAssetDefinition: Bool
init(contract: String) {
contractAddress = contract.add0x.lowercased()
let assetDefinitionStore = AssetDefinitionStore()

@ -13,35 +13,22 @@ protocol BrowserCoordinatorDelegate: class {
}
final class BrowserCoordinator: NSObject, Coordinator {
var coordinators: [Coordinator] = []
let session: WalletSession
let keystore: Keystore
let navigationController: NavigationController
private let session: WalletSession
private let keystore: Keystore
lazy var bookmarksViewController: BookmarkViewController = {
private lazy var bookmarksViewController: BookmarkViewController = {
let controller = BookmarkViewController(bookmarksStore: bookmarksStore)
controller.delegate = self
return controller
}()
lazy var historyViewController: HistoryViewController = {
private lazy var historyViewController: HistoryViewController = {
let controller = HistoryViewController(store: historyStore)
controller.delegate = self
return controller
}()
lazy var rootViewController: MasterBrowserViewController = {
let controller = MasterBrowserViewController(
bookmarksViewController: bookmarksViewController,
historyViewController: historyViewController,
browserViewController: browserViewController,
type: .browser
)
controller.delegate = self
return controller
}()
lazy var browserViewController: BrowserViewController = {
private lazy var browserViewController: BrowserViewController = {
let controller = BrowserViewController(account: session.account, config: session.config, server: server)
controller.delegate = self
controller.webView.uiDelegate = self
@ -54,26 +41,39 @@ final class BrowserCoordinator: NSObject, Coordinator {
private lazy var historyStore: HistoryStore = {
return HistoryStore(realm: sharedRealm)
}()
lazy var preferences: PreferencesController = {
private lazy var preferences: PreferencesController = {
return PreferencesController()
}()
var urlParser: BrowserURLParser {
private var urlParser: BrowserURLParser {
let engine = SearchEngine(rawValue: preferences.get(for: .browserSearchEngine)) ?? .default
return BrowserURLParser(engine: engine)
}
var server: RPCServer {
private var server: RPCServer {
return session.config.server
}
weak var delegate: BrowserCoordinatorDelegate?
var enableToolbar: Bool = true {
private var enableToolbar: Bool = true {
didSet {
navigationController.isToolbarHidden = !enableToolbar
}
}
var coordinators: [Coordinator] = []
let navigationController: NavigationController
lazy var rootViewController: MasterBrowserViewController = {
let controller = MasterBrowserViewController(
bookmarksViewController: bookmarksViewController,
historyViewController: historyViewController,
browserViewController: browserViewController,
type: .browser
)
controller.delegate = self
return controller
}()
weak var delegate: BrowserCoordinatorDelegate?
init(
session: WalletSession,
keystore: Keystore,

@ -4,13 +4,13 @@ import Foundation
import RealmSwift
final class HistoryStore {
private let realm: Realm
var histories: Results<History> {
return realm.objects(History.self)
.sorted(byKeyPath: "createdAt", ascending: false)
}
let realm: Realm
init(realm: Realm) {
self.realm = realm
}

@ -3,8 +3,8 @@
import Foundation
final class BrowserURLParser {
let urlRegEx = try! NSRegularExpression(pattern: "^(http(s)?://)?[a-z0-9-_]+(\\.[a-z0-9-_]+)+(/)?", options: .caseInsensitive)
let validSchemes = ["http", "https"]
private let urlRegEx = try! NSRegularExpression(pattern: "^(http(s)?://)?[a-z0-9-_]+(\\.[a-z0-9-_]+)+(/)?", options: .caseInsensitive)
private let validSchemes = ["http", "https"]
let engine: SearchEngine
init(

@ -9,19 +9,16 @@ protocol BookmarkViewControllerDelegate: class {
}
final class BookmarkViewController: UIViewController {
let tableView = UITableView(frame: .zero, style: .plain)
private let tableView = UITableView(frame: .zero, style: .plain)
private let bookmarksStore: BookmarksStore
weak var delegate: BookmarkViewControllerDelegate?
private let bookmarksStore: BookmarksStore
lazy var viewModel: BookmarksViewModel = {
return BookmarksViewModel(bookmarksStore: bookmarksStore)
}()
init(
bookmarksStore: BookmarksStore
) {
init(bookmarksStore: BookmarksStore) {
self.bookmarksStore = bookmarksStore
super.init(nibName: nil, bundle: nil)

@ -22,10 +22,9 @@ protocol BrowserViewControllerDelegate: class {
}
final class BrowserViewController: UIViewController {
private var myContext = 0
let account: Wallet
let sessionConfig: Config
private let account: Wallet
private let sessionConfig: Config
private struct Keys {
static let estimatedProgress = "estimatedProgress"
@ -38,6 +37,19 @@ final class BrowserViewController: UIViewController {
return Keys.ClientName + "/" + (Bundle.main.versionNumber ?? "")
}()
private lazy var errorView: BrowserErrorView = {
let errorView = BrowserErrorView()
errorView.translatesAutoresizingMaskIntoConstraints = false
errorView.delegate = self
return errorView
}()
private var browserNavBar: BrowserNavigationBar? {
return navigationController?.navigationBar as? BrowserNavigationBar
}
weak var delegate: BrowserViewControllerDelegate?
lazy var webView: WKWebView = {
let webView = WKWebView(
frame: .zero,
@ -52,19 +64,6 @@ final class BrowserViewController: UIViewController {
return webView
}()
lazy var errorView: BrowserErrorView = {
let errorView = BrowserErrorView()
errorView.translatesAutoresizingMaskIntoConstraints = false
errorView.delegate = self
return errorView
}()
weak var delegate: BrowserViewControllerDelegate?
private var browserNavBar: BrowserNavigationBar? {
return navigationController?.navigationBar as? BrowserNavigationBar
}
lazy var progressView: UIProgressView = {
let progressView = UIProgressView(progressViewStyle: .default)
progressView.translatesAutoresizingMaskIntoConstraints = false

@ -8,10 +8,9 @@ protocol HistoryViewControllerDelegate: class {
}
final class HistoryViewController: UIViewController {
let store: HistoryStore
let tableView = UITableView(frame: .zero, style: .plain)
lazy var viewModel: HistoriesViewModel = {
private let store: HistoryStore
private let tableView = UITableView(frame: .zero, style: .plain)
private lazy var viewModel: HistoriesViewModel = {
return HistoriesViewModel(store: store)
}()

@ -19,7 +19,6 @@ enum BookmarksViewType: Int {
}
final class MasterBrowserViewController: UIViewController {
private lazy var segmentController: UISegmentedControl = {
let items = [
R.string.localizable.new(),
@ -41,10 +40,10 @@ final class MasterBrowserViewController: UIViewController {
return button
}()
weak var delegate: MasterBrowserViewControllerDelegate?
private let bookmarksViewController: BookmarkViewController
private let historyViewController: HistoryViewController
let bookmarksViewController: BookmarkViewController
let historyViewController: HistoryViewController
weak var delegate: MasterBrowserViewControllerDelegate?
let browserViewController: BrowserViewController
init(

@ -4,8 +4,8 @@ import Foundation
import UIKit
struct BookmarkViewModel: URLViewModel {
private let bookmark: Bookmark
let bookmark: Bookmark
init(
bookmark: Bookmark
) {

@ -5,7 +5,7 @@ import RealmSwift
struct BookmarksViewModel {
let bookmarksStore: BookmarksStore
private let bookmarksStore: BookmarksStore
init(
bookmarksStore: BookmarksStore

@ -4,7 +4,7 @@ import Foundation
struct HistoriesViewModel {
let store: HistoryStore
private let store: HistoryStore
init(
store: HistoryStore

@ -5,7 +5,7 @@ import UIKit
struct HistoryViewModel: URLViewModel {
let history: History
private let history: History
init(
history: History

@ -7,14 +7,11 @@ protocol BrowserErrorViewDelegate: class {
}
final class BrowserErrorView: UIView {
weak var delegate: BrowserErrorViewDelegate?
private let topMargin: CGFloat = 120
private let leftMargin: CGFloat = 40
private let buttonTopMargin: CGFloat = 6
lazy var textLabel: UILabel = {
private lazy var textLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.textColor = Colors.gray
@ -23,7 +20,7 @@ final class BrowserErrorView: UIView {
return label
}()
lazy var reloadButton: Button = {
private lazy var reloadButton: Button = {
let button = Button(size: .normal, style: .borderless)
button.addTarget(self, action: #selector(reloadTapped), for: .touchUpInside)
button.setTitle(R.string.localizable.browserReloadButtonTitle(), for: .normal)
@ -32,6 +29,8 @@ final class BrowserErrorView: UIView {
return button
}()
weak var delegate: BrowserErrorViewDelegate?
init() {
super.init(frame: CGRect.zero)
finishInit()

@ -7,19 +7,19 @@ protocol BrowserNavigationBarDelegate: class {
}
final class BrowserNavigationBar: UINavigationBar {
let textField = UITextField()
let moreButton = UIButton()
let closeButton = UIButton()
let homeButton = UIButton()
let backButton = UIButton()
weak var browserDelegate: BrowserNavigationBarDelegate?
private let moreButton = UIButton()
private let homeButton = UIButton()
private struct Layout {
static let width: CGFloat = 34
static let moreButtonWidth: CGFloat = 24
}
let textField = UITextField()
let closeButton = UIButton()
let backButton = UIButton()
weak var browserDelegate: BrowserNavigationBarDelegate?
override init(frame: CGRect) {
super.init(frame: frame)

@ -4,13 +4,10 @@ import Foundation
import UIKit
class CheckDeviceCoordinator: Coordinator {
var coordinators: [Coordinator] = []
let navigationController: UINavigationController
let jailbreakChecker: JailbreakChecker
private let navigationController: UINavigationController
private let jailbreakChecker: JailbreakChecker
lazy var alertViewController: UIAlertController = {
private lazy var alertViewController: UIAlertController = {
let controller = UIAlertController(
title: R.string.localizable.appDeviceJailbreakTitle(),
message: R.string.localizable.appDeviceJailbreakDescription(),
@ -22,6 +19,8 @@ class CheckDeviceCoordinator: Coordinator {
return controller
}()
var coordinators: [Coordinator] = []
init(
navigationController: UINavigationController,
jailbreakChecker: JailbreakChecker

@ -6,7 +6,7 @@ import WebKit
///Reason for this class: https://stackoverflow.com/questions/26383031/wkwebview-causes-my-view-controller-to-leak
final class ScriptMessageProxy: NSObject, WKScriptMessageHandler {
weak var delegate: WKScriptMessageHandler?
private weak var delegate: WKScriptMessageHandler?
init(delegate: WKScriptMessageHandler) {
self.delegate = delegate

@ -5,9 +5,9 @@ import RealmSwift
import TrustKeystore
class MigrationInitializer: Initializer {
private let account: Wallet
private let chainID: Int
let account: Wallet
let chainID: Int
lazy var config: Realm.Configuration = {
return RealmConfiguration.configuration(for: account, chainID: chainID)
}()

@ -4,7 +4,7 @@ import Foundation
struct SkipBackupFilesInitializer: Initializer {
let urls: [URL]
private let urls: [URL]
init(paths: [URL]) {
self.urls = paths

@ -4,10 +4,10 @@ import Foundation
import BigInt
struct GasViewModel {
let fee: BigInt
let symbol: String
let currencyRate: CurrencyRate?
let formatter: EtherNumberFormatter
private let fee: BigInt
private let symbol: String
private let currencyRate: CurrencyRate?
private let formatter: EtherNumberFormatter
init(
fee: BigInt,

@ -3,8 +3,7 @@
import Foundation
struct InCoordinatorViewModel {
let config: Config
private let config: Config
init(config: Config) {
self.config = config

@ -8,11 +8,11 @@ protocol DepositCoordinatorDelegate: class, CanOpenURL {
}
class DepositCoordinator: Coordinator {
private let account: Wallet
private weak var delegate: DepositCoordinatorDelegate?
let navigationController: UINavigationController
let account: Wallet
var coordinators: [Coordinator] = []
weak var delegate: DepositCoordinatorDelegate?
init(
navigationController: UINavigationController,

@ -4,12 +4,13 @@ import Foundation
import RealmSwift
struct CoinTicker: Codable {
let id: String
let symbol: String
var price_usd: String
private let id: String
private let symbol: String
private let image: String = ""
let price_usd: String
let percent_change_24h: String
let contract: String = Constants.nullAddress
let image: String = ""
lazy var rate: CurrencyRate = {
CurrencyRate(

@ -12,17 +12,18 @@ enum EtherKeystoreError: LocalizedError {
}
open class EtherKeystore: Keystore {
struct Keys {
private struct Keys {
static let recentlyUsedAddress: String = "recentlyUsedAddress"
static let watchAddresses = "watchAddresses"
}
private let keychain: KeychainSwift
private let datadir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let keyStore: KeyStore
private let keyStore: KeyStore
private let defaultKeychainAccess: KeychainSwiftAccessOptions = .accessibleWhenUnlockedThisDeviceOnly
private let userDefaults: UserDefaults
let keystoreDirectory: URL
let userDefaults: UserDefaults
public init(
keychain: KeychainSwift = KeychainSwift(keyPrefix: Constants.keychainKeyPrefix),

@ -9,7 +9,7 @@ protocol Signer {
}
struct EIP155Signer: Signer {
let chainId: BigInt
private let chainId: BigInt
init(chainId: BigInt) {
self.chainId = chainId

@ -12,11 +12,11 @@ protocol BackupCoordinatorDelegate: class {
}
class BackupCoordinator: Coordinator {
private let keystore: Keystore
private let account: Account
let navigationController: UINavigationController
weak var delegate: BackupCoordinatorDelegate?
let keystore: Keystore
let account: Account
var coordinators: [Coordinator] = []
init(

@ -9,9 +9,10 @@ protocol PromptBackupCoordinatorDelegate: class {
///We allow user to switch wallets, so it's important to know which wallet we are prompting for. It might not be the current wallet
class PromptBackupCoordinator: Coordinator {
private var walletAddress: String
var coordinators: [Coordinator] = []
weak var delegate: PromptBackupCoordinatorDelegate?
var walletAddress: String
init(walletAddress: String) {
self.walletAddress = walletAddress

@ -9,10 +9,10 @@ protocol BackupViewControllerDelegate: class {
}
class BackupViewController: UIViewController {
private let account: Account
private let viewModel = BackupViewModel()
let account: Account
weak var delegate: BackupViewControllerDelegate?
let viewModel = BackupViewModel()
init(account: Account) {
self.account = account

@ -4,7 +4,7 @@ import Foundation
struct BackupViewModel {
let config: Config
private let config: Config
init(
config: Config = Config()

@ -4,19 +4,12 @@
import UIKit
class LockView: UIView {
var characterView = UIStackView()
private var characterView = UIStackView()
private var model: LockViewModel
var lockTitle = UILabel()
var model: LockViewModel
var characters: [PasscodeCharacterView]!
init(_ model: LockViewModel) {
self.model = model
super.init(frame: CGRect.zero)
self.characters = passcodeCharacters()
configCharacterView()
configLabel()
addUiElements()
applyConstraints()
}
private func configCharacterView() {
characterView = UIStackView(arrangedSubviews: characters)
characterView.axis = .horizontal
@ -54,6 +47,17 @@ class LockView: UIView {
}
return characters
}
init(_ model: LockViewModel) {
self.model = model
super.init(frame: CGRect.zero)
self.characters = passcodeCharacters()
configCharacterView()
configLabel()
addUiElements()
applyConstraints()
}
func shake() {
let keypath = "position"
let animation = CABasicAnimation(keyPath: keypath)

@ -4,12 +4,14 @@
import UIKit
class PasscodeCharacterView: UIView {
var isEmpty = true
private var isEmpty = true
private var circle: CAShapeLayer?
private var hyphen: CAShapeLayer?
override func layoutSubviews() {
commonInit()
}
private func commonInit() {
isEmpty = true
backgroundColor = UIColor.clear
@ -17,10 +19,12 @@ class PasscodeCharacterView: UIView {
drawHyphen()
redraw()
}
private func redraw() {
circle?.isHidden = isEmpty
hyphen?.isHidden = !isEmpty
}
private func drawCircle() {
let borderWidth: CGFloat = 2
let radius: CGFloat = bounds.width / 2 - borderWidth
@ -33,6 +37,7 @@ class PasscodeCharacterView: UIView {
layer.addSublayer(circle)
self.circle = circle
}
private func drawHyphen() {
let horizontalMargin: CGFloat = 2
let hyphenHeight: CGFloat = bounds.height / 7
@ -53,6 +58,7 @@ class PasscodeCharacterView: UIView {
layer.addSublayer(hyphen)
self.hyphen = hyphen
}
func setEmpty(_ isEmpty: Bool) {
if self.isEmpty != isEmpty {
self.isEmpty = isEmpty

@ -22,8 +22,8 @@ import BigInt
public class MarketQueueHandler {
public let baseURL = "https://482kdh4npg.execute-api.ap-southeast-1.amazonaws.com/dev/"
public let contractAddress = "bC9a1026A4BC6F0BA8Bbe486d1D09dA5732B39e4".lowercased()
private let baseURL = "https://482kdh4npg.execute-api.ap-southeast-1.amazonaws.com/dev/"
private let contractAddress = "bC9a1026A4BC6F0BA8Bbe486d1D09dA5732B39e4".lowercased()
public func getOrders(callback: @escaping (_ result: Any) -> Void) {
Alamofire.request(baseURL + "contract/" + contractAddress, method: .get).responseJSON { [weak self] response in

@ -14,22 +14,24 @@ class ImportMagicTokenViewController: UIViewController, OptionalTokenVerifiableS
case notReady
}
private let roundedBackground = RoundedBackground()
private let header = TokensCardViewControllerTitleHeader()
private let tokenCardRowView = TokenCardRowView()
private let statusLabel = UILabel()
private let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge)
private var costStackView: UIStackView?
private let ethCostLabelLabel = UILabel()
private let ethCostLabel = UILabel()
private let dollarCostLabelLabel = UILabel()
private let dollarCostLabel = PaddedLabel()
private let buttonSeparator = UIView()
private let actionButton = UIButton(type: .system)
private let cancelButton = UIButton(type: .system)
private var viewModel: ImportMagicTokenViewControllerViewModel?
let config: Config
weak var delegate: ImportMagicTokenViewControllerDelegate?
let roundedBackground = RoundedBackground()
let header = TokensCardViewControllerTitleHeader()
let tokenCardRowView = TokenCardRowView()
let statusLabel = UILabel()
let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge)
var costStackView: UIStackView?
let ethCostLabelLabel = UILabel()
let ethCostLabel = UILabel()
let dollarCostLabelLabel = UILabel()
let dollarCostLabel = PaddedLabel()
let buttonSeparator = UIView()
let actionButton = UIButton(type: .system)
let cancelButton = UIButton(type: .system)
private var viewModel: ImportMagicTokenViewControllerViewModel?
var contract: String? {
didSet {
guard url != nil else { return }

@ -7,13 +7,14 @@ protocol StatusViewControllerDelegate: class {
}
class StatusViewController: UIViewController {
private let background = UIView()
private let imageView = UIImageView()
private let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge)
private let titleLabel = UILabel()
private let actionButton = UIButton()
private var viewModel: StatusViewControllerViewModel?
weak var delegate: StatusViewControllerDelegate?
let background = UIView()
let imageView = UIImageView()
let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge)
let titleLabel = UILabel()
let actionButton = UIButton()
var viewModel: StatusViewControllerViewModel?
init() {
super.init(nibName: nil, bundle: nil)

@ -3,7 +3,7 @@
import Foundation
struct ImportMagicTokenCardRowViewModel: TokenCardRowViewModelProtocol {
var importMagicTokenViewControllerViewModel: ImportMagicTokenViewControllerViewModel
private var importMagicTokenViewControllerViewModel: ImportMagicTokenViewControllerViewModel
init(importMagicTokenViewControllerViewModel: ImportMagicTokenViewControllerViewModel) {
self.importMagicTokenViewControllerViewModel = importMagicTokenViewControllerViewModel

@ -8,10 +8,12 @@ struct StatusViewControllerViewModel {
case succeeded
case failed
}
private let inProgressText: String
private let succeededTextText: String
private let failedText: String
var state: State
let inProgressText: String
let succeededTextText: String
let failedText: String
var contentsBackgroundColor: UIColor {
return Colors.appWhite

@ -3,7 +3,7 @@
import UIKit
class MarketplaceViewController: UIViewController {
let comingSoonLabel = UILabel()
private let comingSoonLabel = UILabel()
init() {
super.init(nibName: nil, bundle: nil)

@ -4,14 +4,18 @@
import UIKit
class ProtectionCoordinator: Coordinator {
var coordinators: [Coordinator] = []
lazy var splashCoordinator: SplashCoordinator = {
private lazy var splashCoordinator: SplashCoordinator = {
return SplashCoordinator(window: protectionWindow)
}()
lazy var lockEnterPasscodeCoordinator: LockEnterPasscodeCoordinator = {
private lazy var lockEnterPasscodeCoordinator: LockEnterPasscodeCoordinator = {
return LockEnterPasscodeCoordinator(model: LockEnterPasscodeViewModel())
}()
let protectionWindow = UIWindow()
private let protectionWindow = UIWindow()
var coordinators: [Coordinator] = []
init() {
protectionWindow.windowLevel = UIWindowLevelStatusBar + 2.0
}

@ -3,15 +3,19 @@
import UIKit
class SplashCoordinator: Coordinator {
var coordinators: [Coordinator] = []
private let window: UIWindow
var coordinators: [Coordinator] = []
init(window: UIWindow) {
self.window = window
}
func start() {
window.rootViewController = SplashViewController()
window.isHidden = false
}
func stop() {
window.isHidden = true
}

@ -5,6 +5,7 @@ import UIKit
class SplashViewController: UIViewController {
private var splashView = SplashView()
init() {
super.init(nibName: nil, bundle: nil)
splashView.translatesAutoresizingMaskIntoConstraints = false

@ -14,6 +14,7 @@ class SplashView: UIView {
logoImageView.centerYAnchor.constraint(equalTo: centerYAnchor),
])
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

@ -10,7 +10,6 @@ import Foundation
import TrustKeystore
class RedeemEventListener {
var shouldListen = false
func start(for address: Address,

@ -11,7 +11,6 @@ import TrustKeystore
import BigInt
class SignatureHelper {
class func signatureAsHex(for message: String, account: Account) -> String? {
let keystore = try! EtherKeystore()
let signature = keystore.signMessageData(message.data(using: String.Encoding.utf8), for: account)

@ -11,7 +11,6 @@ import Result
import TrustKeystore
public class EventsRest {
func getEvents(for address: Address,
completion: @escaping (Result<[Event], AnyError>) -> Void) {
let endpoint = EndPoints.EventBaseUrl + "/" + address.description.lowercased()

@ -14,19 +14,19 @@ protocol RedeemTokenCardQuantitySelectionViewControllerDelegate: class, CanOpenU
}
class RedeemTokenCardQuantitySelectionViewController: UIViewController, TokenVerifiableStatusViewController {
private let token: TokenObject
private let roundedBackground = RoundedBackground()
private let header = TokensCardViewControllerTitleHeader()
private let subtitleLabel = UILabel()
private let quantityStepper = NumberStepper()
private let tokenRowView: TokenRowView & UIView
private let nextButton = UIButton(type: .system)
private var viewModel: RedeemTokenCardQuantitySelectionViewModel
let config: Config
var contract: String {
return token.contract
}
private let token: TokenObject
let roundedBackground = RoundedBackground()
let header = TokensCardViewControllerTitleHeader()
let subtitleLabel = UILabel()
let quantityStepper = NumberStepper()
let tokenRowView: TokenRowView & UIView
let nextButton = UIButton(type: .system)
var viewModel: RedeemTokenCardQuantitySelectionViewModel
weak var delegate: RedeemTokenCardQuantitySelectionViewControllerDelegate?
init(config: Config, token: TokenObject, viewModel: RedeemTokenCardQuantitySelectionViewModel) {

@ -15,17 +15,17 @@ protocol RedeemTokenViewControllerDelegate: class, CanOpenURL {
}
class RedeemTokenViewController: UIViewController, TokenVerifiableStatusViewController {
private let token: TokenObject
private let roundedBackground = RoundedBackground()
private let header = TokensCardViewControllerTitleHeader()
private let tableView = UITableView(frame: .zero, style: .plain)
private let nextButton = UIButton(type: .system)
private var viewModel: RedeemTokenCardViewModel
let config: Config
var contract: String {
return token.contract
}
private let token: TokenObject
let roundedBackground = RoundedBackground()
let header = TokensCardViewControllerTitleHeader()
let tableView = UITableView(frame: .zero, style: .plain)
let nextButton = UIButton(type: .system)
var viewModel: RedeemTokenCardViewModel
weak var delegate: RedeemTokenViewControllerDelegate?
init(config: Config, token: TokenObject, viewModel: RedeemTokenCardViewModel) {

@ -12,19 +12,19 @@ protocol TokenCardRedemptionViewControllerDelegate: class, CanOpenURL {
}
class TokenCardRedemptionViewController: UIViewController, TokenVerifiableStatusViewController {
private var viewModel: TokenCardRedemptionViewModel
private var titleLabel = UILabel()
private let imageView = UIImageView()
private let tokenRowView: TokenRowView & UIView
private var timer: Timer!
private var session: WalletSession
private let token: TokenObject
private let redeemListener = RedeemEventListener()
let config: Config
var contract: String {
return token.contract
}
var viewModel: TokenCardRedemptionViewModel
var titleLabel = UILabel()
let imageView = UIImageView()
let tokenRowView: TokenRowView & UIView
var timer: Timer!
var session: WalletSession
private let token: TokenObject
let redeemListener = RedeemEventListener()
weak var delegate: TokenCardRedemptionViewControllerDelegate?
init(config: Config, session: WalletSession, token: TokenObject, viewModel: TokenCardRedemptionViewModel) {

@ -10,9 +10,8 @@ import Foundation
import UIKit
struct RedeemTokenCardQuantitySelectionViewModel {
var token: TokenObject
var tokenHolder: TokenHolder
let token: TokenObject
let tokenHolder: TokenHolder
var headerTitle: String {
let tokenTypeName = XMLHandler(contract: token.address.eip55String).getTokenTypeName()

@ -10,9 +10,8 @@ import Foundation
import UIKit
struct RedeemTokenCardViewModel {
var token: TokenObject
var tokenHolders: [TokenHolder]
let token: TokenObject
let tokenHolders: [TokenHolder]
init(token: TokenObject) {
self.token = token

@ -10,8 +10,8 @@ import Foundation
import UIKit
struct TokenCardRedemptionViewModel {
var token: TokenObject
var tokenHolder: TokenHolder
let token: TokenObject
let tokenHolder: TokenHolder
var headerTitle: String {
return R.string.localizable.aWalletTokenRedeemShowQRCodeTitle()

@ -14,7 +14,6 @@ enum RestError: Error {
}
struct RestClient {
static func get(endPoint: String,
parameters: [String: AnyHashable]? = nil,
completion: @escaping (_ response: DataResponse<Any>) -> Void) {

@ -9,29 +9,22 @@ protocol EnterSellTokensCardPriceQuantityViewControllerDelegate: class, CanOpenU
}
class EnterSellTokensCardPriceQuantityViewController: UIViewController, TokenVerifiableStatusViewController {
let config: Config
var contract: String {
return viewModel.token.contract
}
let storage: TokensDataStore
let roundedBackground = RoundedBackground()
let scrollView = UIScrollView()
let header = TokensCardViewControllerTitleHeader()
let pricePerTokenLabel = UILabel()
let pricePerTokenField = AmountTextField()
let quantityLabel = UILabel()
let quantityStepper = NumberStepper()
let ethCostLabelLabel = UILabel()
let ethCostLabel = UILabel()
let dollarCostLabelLabel = UILabel()
let dollarCostLabel = PaddedLabel()
let tokenRowView: TokenRowView & UIView
let nextButton = UIButton(type: .system)
var viewModel: EnterSellTokensCardPriceQuantityViewControllerViewModel
let paymentFlow: PaymentFlow
let ethPrice: Subscribable<Double>
var totalEthCost: Ether {
private let storage: TokensDataStore
private let roundedBackground = RoundedBackground()
private let scrollView = UIScrollView()
private let header = TokensCardViewControllerTitleHeader()
private let pricePerTokenLabel = UILabel()
private let quantityLabel = UILabel()
private let quantityStepper = NumberStepper()
private let ethCostLabelLabel = UILabel()
private let ethCostLabel = UILabel()
private let dollarCostLabelLabel = UILabel()
private let dollarCostLabel = PaddedLabel()
private let tokenRowView: TokenRowView & UIView
private let nextButton = UIButton(type: .system)
private var viewModel: EnterSellTokensCardPriceQuantityViewControllerViewModel
private let ethPrice: Subscribable<Double>
private var totalEthCost: Ether {
if let ethCostPerToken = Ether(string: pricePerTokenField.ethCost) {
let quantity = Int(quantityStepper.value)
return ethCostPerToken * quantity
@ -40,7 +33,7 @@ class EnterSellTokensCardPriceQuantityViewController: UIViewController, TokenVer
}
}
var totalDollarCost: String {
private var totalDollarCost: String {
if let dollarCostPerToken = Double(pricePerTokenField.dollarCost) {
let quantity = Double(quantityStepper.value)
return StringFormatter().currency(with: dollarCostPerToken * quantity, and: "USD")
@ -48,6 +41,13 @@ class EnterSellTokensCardPriceQuantityViewController: UIViewController, TokenVer
return ""
}
}
let config: Config
var contract: String {
return viewModel.token.contract
}
let pricePerTokenField = AmountTextField()
let paymentFlow: PaymentFlow
weak var delegate: EnterSellTokensCardPriceQuantityViewControllerDelegate?
init(

@ -9,22 +9,23 @@ protocol GenerateSellMagicLinkViewControllerDelegate: class {
}
class GenerateSellMagicLinkViewController: UIViewController {
private let background = UIView()
private let header = TokensCardViewControllerTitleHeader()
private let detailsBackground = UIView()
private let subtitleLabel = UILabel()
private let tokenCountLabel = UILabel()
private let perTokenPriceLabel = UILabel()
private let totalEthLabel = UILabel()
private let descriptionLabel = UILabel()
private let actionButton = UIButton()
private let cancelButton = UIButton()
private var viewModel: GenerateSellMagicLinkViewControllerViewModel?
weak var delegate: GenerateSellMagicLinkViewControllerDelegate?
let background = UIView()
let header = TokensCardViewControllerTitleHeader()
let detailsBackground = UIView()
let subtitleLabel = UILabel()
let tokenCountLabel = UILabel()
let perTokenPriceLabel = UILabel()
let totalEthLabel = UILabel()
let descriptionLabel = UILabel()
let actionButton = UIButton()
let cancelButton = UIButton()
let paymentFlow: PaymentFlow
let tokenHolder: TokenHolder
let ethCost: Ether
let linkExpiryDate: Date
var viewModel: GenerateSellMagicLinkViewControllerViewModel?
init(paymentFlow: PaymentFlow, tokenHolder: TokenHolder, ethCost: Ether, linkExpiryDate: Date) {
self.paymentFlow = paymentFlow

@ -9,16 +9,16 @@ protocol SellTokensCardViewControllerDelegate: class, CanOpenURL {
}
class SellTokensCardViewController: UIViewController, TokenVerifiableStatusViewController {
private let roundedBackground = RoundedBackground()
private let header = TokensCardViewControllerTitleHeader()
private let tableView = UITableView(frame: .zero, style: .plain)
private let nextButton = UIButton(type: .system)
private var viewModel: SellTokensCardViewModel
let config: Config
var contract: String {
return viewModel.token.contract
}
let roundedBackground = RoundedBackground()
let header = TokensCardViewControllerTitleHeader()
let tableView = UITableView(frame: .zero, style: .plain)
let nextButton = UIButton(type: .system)
var viewModel: SellTokensCardViewModel
let paymentFlow: PaymentFlow
weak var delegate: SellTokensCardViewControllerDelegate?

@ -8,34 +8,34 @@ protocol SetSellTokensCardExpiryDateViewControllerDelegate: class, CanOpenURL {
}
class SetSellTokensCardExpiryDateViewController: UIViewController, TokenVerifiableStatusViewController {
private let storage: TokensDataStore
private let roundedBackground = RoundedBackground()
private let scrollView = UIScrollView()
private let header = TokensCardViewControllerTitleHeader()
private let linkExpiryDateLabel = UILabel()
private let linkExpiryDateField = DateEntryField()
private let linkExpiryTimeLabel = UILabel()
private let linkExpiryTimeField = TimeEntryField()
private let tokenCountLabel = UILabel()
private let perTokenPriceLabel = UILabel()
private let totalEthLabel = UILabel()
private let descriptionLabel = UILabel()
private let noteTitleLabel = UILabel()
private let noteLabel = UILabel()
private let noteBorderView = UIView()
private let tokenRowView: TokenRowView & UIView
private let nextButton = UIButton(type: .system)
private let datePicker = UIDatePicker()
private let timePicker = UIDatePicker()
private var viewModel: SetSellTokensCardExpiryDateViewControllerViewModel
private let tokenHolder: TokenHolder
private let ethCost: Ether
let config: Config
var contract: String {
return viewModel.token.contract
}
let storage: TokensDataStore
let roundedBackground = RoundedBackground()
let scrollView = UIScrollView()
let header = TokensCardViewControllerTitleHeader()
let linkExpiryDateLabel = UILabel()
let linkExpiryDateField = DateEntryField()
let linkExpiryTimeLabel = UILabel()
let linkExpiryTimeField = TimeEntryField()
let tokenCountLabel = UILabel()
let perTokenPriceLabel = UILabel()
let totalEthLabel = UILabel()
let descriptionLabel = UILabel()
let noteTitleLabel = UILabel()
let noteLabel = UILabel()
let noteBorderView = UIView()
let tokenRowView: TokenRowView & UIView
let nextButton = UIButton(type: .system)
let datePicker = UIDatePicker()
let timePicker = UIDatePicker()
var viewModel: SetSellTokensCardExpiryDateViewControllerViewModel
let paymentFlow: PaymentFlow
let tokenHolder: TokenHolder
let ethCost: Ether
weak var delegate: SetSellTokensCardExpiryDateViewControllerDelegate?
init(

@ -4,9 +4,8 @@ import Foundation
import UIKit
struct EnterSellTokensCardPriceQuantityViewControllerViewModel {
var token: TokenObject
var tokenHolder: TokenHolder
let token: TokenObject
let tokenHolder: TokenHolder
var ethCost: Ether = .zero
var dollarCost: String = ""

@ -3,9 +3,9 @@
import UIKit
struct GenerateSellMagicLinkViewControllerViewModel {
let tokenHolder: TokenHolder
let ethCost: Ether
let linkExpiryDate: Date
private let tokenHolder: TokenHolder
private let ethCost: Ether
private let linkExpiryDate: Date
var contentsBackgroundColor: UIColor {
return Colors.appWhite

@ -3,8 +3,8 @@
import UIKit
struct GenerateTransferMagicLinkViewControllerViewModel {
var tokenHolder: TokenHolder
var linkExpiryDate: Date
private let tokenHolder: TokenHolder
private let linkExpiryDate: Date
var contentsBackgroundColor: UIColor {
return Colors.appWhite

@ -4,9 +4,8 @@ import Foundation
import UIKit
struct SellTokensCardViewModel {
var token: TokenObject
var tokenHolders: [TokenHolder]
let token: TokenObject
let tokenHolders: [TokenHolder]
init(token: TokenObject) {
self.token = token

@ -4,10 +4,10 @@ import Foundation
import UIKit
struct SetSellTokensCardExpiryDateViewControllerViewModel {
private let ethCost: Ether
var token: TokenObject
var tokenHolder: TokenHolder
var ethCost: Ether = .zero
let token: TokenObject
let tokenHolder: TokenHolder
var headerTitle: String {
return R.string.localizable.aWalletTokenSellEnterLinkExpiryDateTitle()

@ -7,7 +7,8 @@ protocol DateEntryFieldDelegate: class {
}
class DateEntryField: UIControl {
var leftButton = UIButton(type: .custom)
private let leftButton = UIButton(type: .custom)
var value = Date() {
didSet {
displayDateString()

@ -7,7 +7,8 @@ protocol TimeEntryFieldDelegate: class {
}
class TimeEntryField: UIControl {
var leftButton = UIButton(type: .custom)
private let leftButton = UIButton(type: .custom)
var value = Date() {
didSet {
displayTimeString()

@ -9,11 +9,9 @@ protocol AddCustomNetworkCoordinatorDelegate: class {
}
class AddCustomNetworkCoordinator: Coordinator {
let navigationController: UINavigationController
var coordinators: [Coordinator] = []
weak var delegate: AddCustomNetworkCoordinatorDelegate?
private let navigationController: UINavigationController
lazy var addNetworkItem: UIBarButtonItem = {
private lazy var addNetworkItem: UIBarButtonItem = {
return UIBarButtonItem(
barButtonSystemItem: .add,
target: self,
@ -21,12 +19,15 @@ class AddCustomNetworkCoordinator: Coordinator {
)
}()
lazy var addCustomNetworkController: AddCustomNetworkViewController = {
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()
) {

@ -4,12 +4,12 @@ import UIKit
import StoreKit
class HelpUsCoordinator: Coordinator {
private let navigationController: UINavigationController
private let appTracker: AppTracker
private let viewModel = HelpUsViewModel()
let navigationController: UINavigationController
let appTracker: AppTracker
var coordinators: [Coordinator] = []
private let viewModel = HelpUsViewModel()
init(
navigationController: UINavigationController = NavigationController(),
appTracker: AppTracker = AppTracker()

@ -7,8 +7,9 @@ protocol LocalesCoordinatorDelegate: class {
}
class LocalesCoordinator: Coordinator {
private var config: Config
var coordinators: [Coordinator] = []
var config: Config
lazy var localesViewController: LocalesViewController = {
let locales: [AppLocale] = [

@ -7,8 +7,9 @@ protocol ServersCoordinatorDelegate: class {
}
class ServersCoordinator: Coordinator {
private var config: Config
var coordinators: [Coordinator] = []
var config: Config
lazy var serversViewController: ServersViewController = {
let servers: [RPCServer] = {

@ -14,12 +14,12 @@ protocol SettingsCoordinatorDelegate: class, CanOpenURL {
}
class SettingsCoordinator: Coordinator {
private let keystore: Keystore
private let session: WalletSession
private let storage: TransactionsStorage
private let balanceCoordinator: GetBalanceCoordinator
let navigationController: UINavigationController
let keystore: Keystore
let session: WalletSession
let storage: TransactionsStorage
let balanceCoordinator: GetBalanceCoordinator
weak var delegate: SettingsCoordinatorDelegate?
var coordinators: [Coordinator] = []

@ -5,7 +5,6 @@ import ObjectiveC
import TrustKeystore
struct Config {
struct Keys {
static let chainID = "chainID"
static let isCryptoPrimaryCurrency = "isCryptoPrimaryCurrency"

@ -3,8 +3,7 @@
import Foundation
struct ConfigExplorer {
let server: RPCServer
private let server: RPCServer
init(
server: RPCServer

@ -5,8 +5,7 @@ import Eureka
import Result
class AddCustomNetworkViewController: FormViewController {
let viewModel = AddCustomNetworkViewModel()
private let viewModel = AddCustomNetworkViewModel()
private struct Values {
static let chainID = "chainID"
@ -15,8 +14,6 @@ class AddCustomNetworkViewController: FormViewController {
static let endpoint = "endpoint"
}
weak var delegate: NewTokenViewControllerDelegate?
private var chainIDRow: TextFloatLabelRow? {
return form.rowBy(tag: Values.chainID) as? TextFloatLabelRow
}
@ -30,6 +27,8 @@ class AddCustomNetworkViewController: FormViewController {
return form.rowBy(tag: Values.endpoint) as? TextFloatLabelRow
}
weak var delegate: NewTokenViewControllerDelegate?
override func viewDidLoad() {
super.viewDidLoad()

@ -8,12 +8,13 @@ protocol LocalesViewControllerDelegate: class {
}
class LocalesViewController: UIViewController {
let headerHeight = CGFloat(70)
private let headerHeight = CGFloat(70)
private let roundedBackground = RoundedBackground()
private let header = TokensCardViewControllerTitleHeader()
private let tableView = UITableView(frame: .zero, style: .plain)
private var viewModel: LocalesViewModel?
weak var delegate: LocalesViewControllerDelegate?
let roundedBackground = RoundedBackground()
let header = TokensCardViewControllerTitleHeader()
let tableView = UITableView(frame: .zero, style: .plain)
var viewModel: LocalesViewModel?
init() {
super.init(nibName: nil, bundle: nil)

@ -3,8 +3,7 @@
import Foundation
final class PreferencesController {
let userDefaults: UserDefaults
private let userDefaults: UserDefaults
init(
userDefaults: UserDefaults = .standard

@ -8,12 +8,13 @@ protocol ServersViewControllerDelegate: class {
}
class ServersViewController: UIViewController {
let headerHeight = CGFloat(70)
private let headerHeight = CGFloat(70)
private let roundedBackground = RoundedBackground()
private let header = TokensCardViewControllerTitleHeader()
private let tableView = UITableView(frame: .zero, style: .plain)
private var viewModel: ServersViewModel?
weak var delegate: ServersViewControllerDelegate?
let roundedBackground = RoundedBackground()
let header = TokensCardViewControllerTitleHeader()
let tableView = UITableView(frame: .zero, style: .plain)
var viewModel: ServersViewModel?
init() {
super.init(nibName: nil, bundle: nil)

@ -12,15 +12,17 @@ protocol SettingsViewControllerDelegate: class, CanOpenURL {
}
class SettingsViewController: FormViewController {
private var lock = Lock()
weak var delegate: SettingsViewControllerDelegate?
var isPasscodeEnabled: Bool {
private let lock = Lock()
private var isPasscodeEnabled: Bool {
return lock.isPasscodeSet()
}
lazy var viewModel: SettingsViewModel = {
private lazy var viewModel: SettingsViewModel = {
return SettingsViewModel(isDebug: isDebug)
}()
let session: WalletSession
private let session: WalletSession
weak var delegate: SettingsViewControllerDelegate?
init(session: WalletSession) {
self.session = session
super.init(style: .plain)

@ -10,7 +10,6 @@ protocol WellDoneViewControllerDelegate: class {
}
class WellDoneViewController: UIViewController {
weak var delegate: WellDoneViewControllerDelegate?
override func viewDidLoad() {

@ -3,7 +3,6 @@
import Foundation
struct AddCustomNetworkViewModel {
var title: String {
return R.string.localizable.settingsCustomNetworkNavigationTitle()
}

@ -3,7 +3,6 @@ import Foundation
import UIKit
struct HelpUsViewModel {
var title: String {
return R.string.localizable.welldoneNavigationTitle()
}

@ -4,8 +4,8 @@ import Foundation
import UIKit
struct LocaleViewModel {
let locale: AppLocale
let isSelected: Bool
private let locale: AppLocale
private let isSelected: Bool
init(locale: AppLocale, selected: Bool) {
self.locale = locale

@ -4,8 +4,8 @@ import Foundation
import UIKit
struct ServerViewModel {
let server: RPCServer
let isSelected: Bool
private let server: RPCServer
private let isSelected: Bool
init(server: RPCServer, selected: Bool) {
self.server = server

@ -4,8 +4,9 @@ import Foundation
import TrustKeystore
struct ServersViewModel {
private let selectedServer: RPCServer
let servers: [RPCServer]
let selectedServer: RPCServer
var title: String {
return R.string.localizable.settingsNetworkButtonTitle()

@ -3,7 +3,6 @@
import Foundation
struct SettingsViewModel {
private let isDebug: Bool
init(
@ -12,23 +11,6 @@ struct SettingsViewModel {
self.isDebug = isDebug
}
var servers: [RPCServer] {
return [
RPCServer.main,
RPCServer.classic,
RPCServer.poa,
// RPCServer.callisto, TODO: Enable.
RPCServer.kovan,
RPCServer.ropsten,
RPCServer.rinkeby,
RPCServer.sokol,
]
}
var currency: [Currency] {
return Currency.allValues.map { $0 }
}
var passcodeTitle: String {
switch BiometryAuthenticationType.current {
case .faceID, .touchID:

@ -17,8 +17,8 @@ open class _AlphaWalletSettingsSwitchRow: Row<AlphaWalletSwitchCell> {
}
open class AlphaWalletSwitchCell: Cell<Bool>, CellType {
private let background = UIView()
let background = UIView()
@IBOutlet public weak var switchControl: UISwitch!
required public init(style: UITableViewCellStyle, reuseIdentifier: String?) {

@ -16,7 +16,8 @@ open class _TextRow: FieldRow<AlphaWalletSettingsTextCell> {
}
open class AlphaWalletSettingsTextCell: _FieldCell<String>, CellType {
let background = UIView()
private let background = UIView()
let mainLabel = UILabel()
let subLabel = UILabel()

@ -6,9 +6,9 @@ import UIKit
class LocaleViewCell: UITableViewCell {
static let identifier = "LocaleViewCell"
let background = UIView()
var selectedIcon = UIImageView(image: R.image.ticket_bundle_checked())
var nameLabel = UILabel()
private let background = UIView()
private let selectedIcon = UIImageView(image: R.image.ticket_bundle_checked())
private let nameLabel = UILabel()
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

@ -6,9 +6,9 @@ import UIKit
class ServerViewCell: UITableViewCell {
static let identifier = "ServerViewCell"
let background = UIView()
var selectedIcon = UIImageView(image: R.image.ticket_bundle_checked())
var nameLabel = UILabel()
private let background = UIView()
private let selectedIcon = UIImageView(image: R.image.ticket_bundle_checked())
private let nameLabel = UILabel()
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

@ -16,9 +16,7 @@ import Result
class ClaimOrderCoordinator {
private let web3: Web3Swift
init(
web3: Web3Swift
) {
init(web3: Web3Swift) {
self.web3 = web3
}

@ -9,7 +9,6 @@ import TrustKeystore
import web3swift
class GetBalanceCoordinator {
private let config: Config
init(config: Config) {

@ -6,7 +6,6 @@ import TrustKeystore
import web3swift
class GetDecimalsCoordinator {
private let config: Config
init(config: Config) {

@ -6,7 +6,6 @@ import TrustKeystore
import web3swift
class GetNameCoordinator {
private let config: Config
init(config: Config) {

@ -6,7 +6,6 @@ import TrustKeystore
import web3swift
class GetSymbolCoordinator {
private let config: Config
init(config: Config) {

@ -24,15 +24,12 @@ private enum ContractData {
}
class TokensCoordinator: Coordinator {
let navigationController: UINavigationController
let session: WalletSession
let keystore: Keystore
var coordinators: [Coordinator] = []
let storage: TokensDataStore
private let session: WalletSession
private let keystore: Keystore
private let storage: TokensDataStore
private let assetDefinitionStore: AssetDefinitionStore
lazy var tokensViewController: TokensViewController = {
private lazy var tokensViewController: TokensViewController = {
let controller = TokensViewController(
session: session,
account: session.account,
@ -41,6 +38,9 @@ class TokensCoordinator: Coordinator {
controller.delegate = self
return controller
}()
let navigationController: UINavigationController
var coordinators: [Coordinator] = []
weak var delegate: TokensCoordinatorDelegate?
lazy var rootViewController: TokensViewController = {

@ -11,7 +11,8 @@ import RealmSwift
import BigInt
class TokenAdaptor {
var token: TokenObject
private let token: TokenObject
init(token: TokenObject) {
self.token = token
}

@ -16,8 +16,8 @@ struct Token {
let id: BigUInt
let index: UInt16
var name: String
var status: Status
let name: String
let status: Status
let values: [String: AssetAttributeValue]
static var empty: Token {

@ -5,7 +5,6 @@ import RealmSwift
import BigInt
class TokenBalance: Object {
@objc dynamic var balance = "0"
convenience init(balance: String = "0") {

@ -9,14 +9,12 @@
import Foundation
class TokenHolder {
var tokens: [Token]
var name: String { return tokens[0].name }
var values: [String: AssetAttributeValue] { return tokens[0].values }
var status: Token.Status { return tokens[0].status }
let tokens: [Token]
let contractAddress: String
let hasAssetDefinition: Bool
var isSelected = false
var areDetailsVisible = false
var contractAddress: String
var hasAssetDefinition: Bool
init(tokens: [Token], contractAddress: String, hasAssetDefinition: Bool) {
self.tokens = tokens
@ -31,4 +29,16 @@ class TokenHolder {
var indices: [UInt16] {
return tokens.map { $0.index }
}
var name: String {
return tokens[0].name
}
var values: [String: AssetAttributeValue] {
return tokens[0].values
}
var status: Token.Status {
return tokens[0].status
}
}

@ -12,11 +12,14 @@ class TokenObject: Object {
@objc dynamic var decimals: Int = 0
@objc dynamic var value: String = ""
@objc dynamic var isDisabled: Bool = false
var balance = List<TokenBalance>()
@objc dynamic var rawType: String = TokenType.erc20.rawValue
let balance = List<TokenBalance>()
var nonZeroBalance: [TokenBalance] {
return Array(balance.filter { isNonZeroBalance($0.balance) })
}
@objc dynamic var rawType: String = TokenType.erc20.rawValue
var type: TokenType {
get {
return TokenType(rawValue: rawType)!

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save