Merge pull request #3076 from vladyslav-iosdev/#3075

Refactor: `SendCoordinator` remove unused dependencies #3075
pull/3079/head
Hwee-Boon Yar 3 years ago committed by GitHub
commit 52da2f67c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      AlphaWallet/Transfer/Coordinators/PaymentCoordinator.swift
  2. 7
      AlphaWallet/Transfer/Coordinators/SendCoordinator.swift
  3. 3
      AlphaWallet/Transfer/ViewControllers/SendViewController.swift
  4. 2
      AlphaWalletTests/Coordinators/SendCoordinatorTests.swift
  5. 1
      AlphaWalletTests/Transfer/ViewControllers/SendViewControllerTests.swift

@ -15,7 +15,6 @@ class PaymentCoordinator: Coordinator {
private let keystore: Keystore
private let storage: TokensDataStore
private let ethPrice: Subscribable<Double>
private let tokenHolders: [TokenHolder]!
private let assetDefinitionStore: AssetDefinitionStore
private let analyticsCoordinator: AnalyticsCoordinator
@ -33,7 +32,6 @@ class PaymentCoordinator: Coordinator {
keystore: Keystore,
storage: TokensDataStore,
ethPrice: Subscribable<Double>,
tokenHolders: [TokenHolder] = [],
assetDefinitionStore: AssetDefinitionStore,
analyticsCoordinator: AnalyticsCoordinator
) {
@ -43,7 +41,6 @@ class PaymentCoordinator: Coordinator {
self.keystore = keystore
self.storage = storage
self.ethPrice = ethPrice
self.tokenHolders = tokenHolders
self.assetDefinitionStore = assetDefinitionStore
self.analyticsCoordinator = analyticsCoordinator
@ -57,16 +54,14 @@ class PaymentCoordinator: Coordinator {
}
switch (flow, session.account.type) {
case (.send(let type), .real(let account)):
case (.send(let type), .real):
let coordinator = SendCoordinator(
transactionType: type,
navigationController: navigationController,
session: session,
keystore: keystore,
storage: storage,
account: account,
ethPrice: ethPrice,
tokenHolders: tokenHolders!,
assetDefinitionStore: assetDefinitionStore,
analyticsCoordinator: analyticsCoordinator
)

@ -15,11 +15,9 @@ protocol SendCoordinatorDelegate: class, CanOpenURL {
class SendCoordinator: Coordinator {
private let transactionType: TransactionType
private let session: WalletSession
private let account: AlphaWallet.Address
private let keystore: Keystore
private let storage: TokensDataStore
private let ethPrice: Subscribable<Double>
private let tokenHolders: [TokenHolder]!
private let assetDefinitionStore: AssetDefinitionStore
private let analyticsCoordinator: AnalyticsCoordinator
private var transactionConfirmationResult: TransactionConfirmationResult = .noData
@ -38,20 +36,16 @@ class SendCoordinator: Coordinator {
session: WalletSession,
keystore: Keystore,
storage: TokensDataStore,
account: AlphaWallet.Address,
ethPrice: Subscribable<Double>,
tokenHolders: [TokenHolder] = [],
assetDefinitionStore: AssetDefinitionStore,
analyticsCoordinator: AnalyticsCoordinator
) {
self.transactionType = transactionType
self.navigationController = navigationController
self.session = session
self.account = account
self.keystore = keystore
self.storage = storage
self.ethPrice = ethPrice
self.tokenHolders = tokenHolders
self.assetDefinitionStore = assetDefinitionStore
self.analyticsCoordinator = analyticsCoordinator
}
@ -66,7 +60,6 @@ class SendCoordinator: Coordinator {
let controller = SendViewController(
session: session,
storage: storage,
account: account,
transactionType: transactionType,
cryptoPrice: ethPrice,
assetDefinitionStore: assetDefinitionStore

@ -27,7 +27,6 @@ class SendViewController: UIViewController {
private var viewModel: SendViewModel
private var balanceViewModel: BalanceBaseViewModel?
private let session: WalletSession
private let account: AlphaWallet.Address
private let ethPrice: Subscribable<Double>
private let assetDefinitionStore: AssetDefinitionStore
private var currentSubscribableKeyForNativeCryptoCurrencyBalance: Subscribable<BalanceBaseViewModel>.SubscribableKey?
@ -58,13 +57,11 @@ class SendViewController: UIViewController {
init(
session: WalletSession,
storage: TokensDataStore,
account: AlphaWallet.Address,
transactionType: TransactionType,
cryptoPrice: Subscribable<Double>,
assetDefinitionStore: AssetDefinitionStore
) {
self.session = session
self.account = account
self.storage = storage
self.ethPrice = cryptoPrice
self.assetDefinitionStore = assetDefinitionStore

@ -13,7 +13,6 @@ class SendCoordinatorTests: XCTestCase {
session: .make(),
keystore: FakeKeystore(),
storage: FakeTokensDataStore(),
account: .make(),
ethPrice: Subscribable<Double>(nil),
assetDefinitionStore: AssetDefinitionStore(),
analyticsCoordinator: FakeAnalyticsService()
@ -32,7 +31,6 @@ class SendCoordinatorTests: XCTestCase {
session: .make(),
keystore: FakeKeystore(),
storage: FakeTokensDataStore(),
account: .make(),
ethPrice: Subscribable<Double>(nil),
assetDefinitionStore: AssetDefinitionStore(),
analyticsCoordinator: FakeAnalyticsService()

@ -135,7 +135,6 @@ class SendViewControllerTests: XCTestCase {
let vc = SendViewController(session: session,
storage: storage,
account: .make(),
transactionType: nativeCryptocurrencyTransactionType,
cryptoPrice: Subscribable<Double>.init(nil),
assetDefinitionStore: AssetDefinitionStore())

Loading…
Cancel
Save