[Refactor] Rename TokensCardCoordinator NFTCollectionCoordinator #4503

pull/4504/head
Krypto Pank 3 years ago
parent d6d9967c16
commit 2612ad8210
  1. 8
      AlphaWallet.xcodeproj/project.pbxproj
  2. 2
      AlphaWallet/ActiveWalletCoordinator.swift
  3. 46
      AlphaWallet/Tokens/Collectibles/Coordinators/NFTCollectionCoordinator.swift
  4. 20
      AlphaWallet/Tokens/Coordinators/SingleChainTokenCoordinator.swift

@ -238,7 +238,7 @@
442FC01053E2F1B59355A961 /* Arguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCC7DC5A13C023F7F2C26 /* Arguments.swift */; };
442FC0B59B23C0F3068621C0 /* NumberStepper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FC575B6A4A50B0555E1B0 /* NumberStepper.swift */; };
442FC249C2A39F85BDBD7987 /* GetDecimalsCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FC0F2E3BB3EE420BC2C16 /* GetDecimalsCoordinator.swift */; };
442FC258BAEFDE2D64E48D0D /* TokensCardCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCC8150042FE9179D574A /* TokensCardCoordinator.swift */; };
442FC258BAEFDE2D64E48D0D /* NFTCollectionCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCC8150042FE9179D574A /* NFTCollectionCoordinator.swift */; };
442FC2CC21FFFC4FAB33A300 /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FC90F0768C43EF903465B /* Token.swift */; };
442FC546ED56F5C9D3D35471 /* TokenCardRedemptionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCBDB86579889BC773540 /* TokenCardRedemptionViewModel.swift */; };
442FC58B7558F28F9452D383 /* GetIsERC875ContractCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCEBC98D0A367D258D2C3 /* GetIsERC875ContractCoordinator.swift */; };
@ -1389,7 +1389,7 @@
442FCBDB86579889BC773540 /* TokenCardRedemptionViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenCardRedemptionViewModel.swift; sourceTree = "<group>"; };
442FCC17EAB857C58732831E /* RedeemTokenCardQuantitySelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RedeemTokenCardQuantitySelectionViewController.swift; sourceTree = "<group>"; };
442FCC7DC5A13C023F7F2C26 /* Arguments.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Arguments.swift; sourceTree = "<group>"; };
442FCC8150042FE9179D574A /* TokensCardCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokensCardCoordinator.swift; sourceTree = "<group>"; };
442FCC8150042FE9179D574A /* NFTCollectionCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NFTCollectionCoordinator.swift; sourceTree = "<group>"; };
442FCCAC6A172506637A2FF6 /* Int.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Int.swift; sourceTree = "<group>"; };
442FCE526E2089CAE88D5602 /* FakeClaimOrderCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FakeClaimOrderCoordinator.swift; sourceTree = "<group>"; };
442FCEBC98D0A367D258D2C3 /* GetIsERC875ContractCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GetIsERC875ContractCoordinator.swift; sourceTree = "<group>"; };
@ -4955,7 +4955,7 @@
8739BBD226CD2A5C0045CFED /* Coordinators */ = {
isa = PBXGroup;
children = (
442FCC8150042FE9179D574A /* TokensCardCoordinator.swift */,
442FCC8150042FE9179D574A /* NFTCollectionCoordinator.swift */,
8739BBD326CD2A820045CFED /* NFTAssetSelectionCoordinator.swift */,
);
path = Coordinators;
@ -6343,7 +6343,7 @@
87F15B0E27F365BF00EB9787 /* TickerIdFilter.swift in Sources */,
442FC81F38F80EEF54C69C5B /* TokenAdaptor.swift in Sources */,
879F184226E73BCF000602F2 /* SelectableNFTAssetContainerTableViewCell.swift in Sources */,
442FC258BAEFDE2D64E48D0D /* TokensCardCoordinator.swift in Sources */,
442FC258BAEFDE2D64E48D0D /* NFTCollectionCoordinator.swift in Sources */,
8703F66B26136A500082EE25 /* RenameWalletViewController.swift in Sources */,
87BBF9912563DD7600FF4846 /* WalletConnectActionType.swift in Sources */,
76F1D91659771C9EEA7B48DC /* CreateRedeem.swift in Sources */,

@ -855,7 +855,7 @@ extension ActiveWalletCoordinator: TokensCoordinatorDelegate {
extension ActiveWalletCoordinator: PaymentCoordinatorDelegate {
func didSelectTokenHolder(tokenHolder: TokenHolder, in coordinator: PaymentCoordinator) {
guard let coordinator = coordinatorOfType(type: TokensCardCoordinator.self) else { return }
guard let coordinator = coordinatorOfType(type: NFTCollectionCoordinator.self) else { return }
coordinator.showNFTAsset(tokenHolder: tokenHolder, mode: .preview)
}

@ -1,4 +1,4 @@
// TokensCardCoordinator.swift
// NFTCollectionCoordinator.swift
// Alpha-Wallet
//
// Created by Oguzhan Gungor on 2/27/18.
@ -12,14 +12,14 @@ import MessageUI
import BigInt
import Combine
protocol TokensCardCoordinatorDelegate: class, CanOpenURL {
func didCancel(in coordinator: TokensCardCoordinator)
func didPress(for type: PaymentFlow, inViewController viewController: UIViewController, in coordinator: TokensCardCoordinator)
func didTap(transaction: TransactionInstance, in coordinator: TokensCardCoordinator)
func didTap(activity: Activity, in coordinator: TokensCardCoordinator)
protocol NFTCollectionCoordinatorDelegate: class, CanOpenURL {
func didCancel(in coordinator: NFTCollectionCoordinator)
func didPress(for type: PaymentFlow, inViewController viewController: UIViewController, in coordinator: NFTCollectionCoordinator)
func didTap(transaction: TransactionInstance, in coordinator: NFTCollectionCoordinator)
func didTap(activity: Activity, in coordinator: NFTCollectionCoordinator)
}
class TokensCardCoordinator: NSObject, Coordinator {
class NFTCollectionCoordinator: NSObject, Coordinator {
private let keystore: Keystore
private let token: TokenObject
lazy var rootViewController: NFTCollectionViewController = {
@ -36,7 +36,7 @@ class TokensCardCoordinator: NSObject, Coordinator {
private let eventsDataStore: NonActivityEventsDataStore
private let analyticsCoordinator: AnalyticsCoordinator
private let activitiesService: ActivitiesServiceType
weak var delegate: TokensCardCoordinatorDelegate?
weak var delegate: NFTCollectionCoordinatorDelegate?
let navigationController: UINavigationController
var coordinators: [Coordinator] = []
private var cancelable = Set<AnyCancellable>()
@ -379,7 +379,7 @@ class TokensCardCoordinator: NSObject, Coordinator {
}
}
extension TokensCardCoordinator: NFTCollectionViewControllerDelegate {
extension NFTCollectionCoordinator: NFTCollectionViewControllerDelegate {
func didSelectAssetSelection(in viewController: NFTCollectionViewController) {
showTokenCardSelection(tokenHolders: viewController.viewModel.tokenHolders)
@ -466,7 +466,7 @@ extension TokensCardCoordinator: NFTCollectionViewControllerDelegate {
}
}
extension TokensCardCoordinator: NFTAssetListViewControllerDelegate {
extension NFTCollectionCoordinator: NFTAssetListViewControllerDelegate {
func selectTokenCardsSelected(in viewController: NFTAssetListViewController) {
showTokenCardSelection(tokenHolders: [viewController.tokenHolder])
}
@ -481,7 +481,7 @@ extension TokensCardCoordinator: NFTAssetListViewControllerDelegate {
}
}
extension TokensCardCoordinator: NFTAssetSelectionCoordinatorDelegate {
extension NFTCollectionCoordinator: NFTAssetSelectionCoordinatorDelegate {
private func showTokenCardSelection(tokenHolders: [TokenHolder]) {
let coordinator = NFTAssetSelectionCoordinator(navigationController: navigationController, tokenObject: token, tokenHolders: tokenHolders, assetDefinitionStore: assetDefinitionStore, analyticsCoordinator: analyticsCoordinator, server: session.server)
@ -504,7 +504,7 @@ extension TokensCardCoordinator: NFTAssetSelectionCoordinatorDelegate {
}
}
extension TokensCardCoordinator: NonFungibleTokenViewControllerDelegate {
extension NFTCollectionCoordinator: NonFungibleTokenViewControllerDelegate {
func didPressTransfer(token: TokenObject, tokenHolder: TokenHolder, forPaymentFlow paymentFlow: PaymentFlow, in viewController: NFTAssetViewController) {
switch token.type {
@ -544,7 +544,7 @@ extension TokensCardCoordinator: NonFungibleTokenViewControllerDelegate {
}
}
extension TokensCardCoordinator: RedeemTokenCardQuantitySelectionViewControllerDelegate {
extension NFTCollectionCoordinator: RedeemTokenCardQuantitySelectionViewControllerDelegate {
func didSelectQuantity(token: TokenObject, tokenHolder: TokenHolder, in viewController: RedeemTokenCardQuantitySelectionViewController) {
showTokenCardRedemptionViewController(token: token, for: tokenHolder, in: viewController)
}
@ -554,7 +554,7 @@ extension TokensCardCoordinator: RedeemTokenCardQuantitySelectionViewControllerD
}
}
extension TokensCardCoordinator: TransferTokenCardQuantitySelectionViewControllerDelegate {
extension NFTCollectionCoordinator: TransferTokenCardQuantitySelectionViewControllerDelegate {
func didSelectQuantity(token: TokenObject, tokenHolder: TokenHolder, in viewController: TransferTokensCardQuantitySelectionViewController) {
showChooseTokensCardTransferModeViewController(token: token, for: tokenHolder, in: viewController)
}
@ -564,7 +564,7 @@ extension TokensCardCoordinator: TransferTokenCardQuantitySelectionViewControlle
}
}
extension TokensCardCoordinator: EnterSellTokensCardPriceQuantityViewControllerDelegate {
extension NFTCollectionCoordinator: EnterSellTokensCardPriceQuantityViewControllerDelegate {
func didEnterSellTokensPriceQuantity(token: TokenObject, tokenHolder: TokenHolder, ethCost: Ether, in viewController: EnterSellTokensCardPriceQuantityViewController) {
showEnterSellTokensCardExpiryDateViewController(token: token, for: tokenHolder, ethCost: ethCost, in: viewController)
}
@ -574,7 +574,7 @@ extension TokensCardCoordinator: EnterSellTokensCardPriceQuantityViewControllerD
}
}
extension TokensCardCoordinator: SetSellTokensCardExpiryDateViewControllerDelegate {
extension NFTCollectionCoordinator: SetSellTokensCardExpiryDateViewControllerDelegate {
func didSetSellTokensExpiryDate(tokenHolder: TokenHolder, linkExpiryDate: Date, ethCost: Ether, in viewController: SetSellTokensCardExpiryDateViewController) {
showSaleConfirmationScreen(for: tokenHolder, linkExpiryDate: linkExpiryDate, ethCost: ethCost, in: viewController)
}
@ -584,7 +584,7 @@ extension TokensCardCoordinator: SetSellTokensCardExpiryDateViewControllerDelega
}
}
extension TokensCardCoordinator: GenerateSellMagicLinkViewControllerDelegate {
extension NFTCollectionCoordinator: GenerateSellMagicLinkViewControllerDelegate {
func didPressShare(in viewController: GenerateSellMagicLinkViewController, sender: UIView) {
sellViaActivitySheet(tokenHolder: viewController.tokenHolder, linkExpiryDate: viewController.linkExpiryDate, ethCost: viewController.ethCost, paymentFlow: viewController.paymentFlow, in: viewController, sender: sender)
}
@ -594,7 +594,7 @@ extension TokensCardCoordinator: GenerateSellMagicLinkViewControllerDelegate {
}
}
extension TokensCardCoordinator: ChooseTokenCardTransferModeViewControllerDelegate {
extension NFTCollectionCoordinator: ChooseTokenCardTransferModeViewControllerDelegate {
func didChooseTransferViaMagicLink(token: TokenObject, tokenHolder: TokenHolder, in viewController: ChooseTokenCardTransferModeViewController) {
let vc = makeEnterTransferTokensCardExpiryDateViewController(token: token, for: tokenHolder, paymentFlow: viewController.paymentFlow)
vc.navigationItem.largeTitleDisplayMode = .never
@ -611,7 +611,7 @@ extension TokensCardCoordinator: ChooseTokenCardTransferModeViewControllerDelega
}
}
extension TokensCardCoordinator: SetTransferTokensCardExpiryDateViewControllerDelegate {
extension NFTCollectionCoordinator: SetTransferTokensCardExpiryDateViewControllerDelegate {
func didPressNext(tokenHolder: TokenHolder, linkExpiryDate: Date, in viewController: SetTransferTokensCardExpiryDateViewController) {
showTransferConfirmationScreen(for: tokenHolder, linkExpiryDate: linkExpiryDate, in: viewController)
}
@ -621,7 +621,7 @@ extension TokensCardCoordinator: SetTransferTokensCardExpiryDateViewControllerDe
}
}
extension TokensCardCoordinator: GenerateTransferMagicLinkViewControllerDelegate {
extension NFTCollectionCoordinator: GenerateTransferMagicLinkViewControllerDelegate {
func didPressShare(in viewController: GenerateTransferMagicLinkViewController, sender: UIView) {
transferViaActivitySheet(tokenHolder: viewController.tokenHolder, linkExpiryDate: viewController.linkExpiryDate, paymentFlow: viewController.paymentFlow, in: viewController, sender: sender)
}
@ -631,10 +631,10 @@ extension TokensCardCoordinator: GenerateTransferMagicLinkViewControllerDelegate
}
}
extension TokensCardCoordinator: TokenCardRedemptionViewControllerDelegate {
extension NFTCollectionCoordinator: TokenCardRedemptionViewControllerDelegate {
}
extension TokensCardCoordinator: CanOpenURL {
extension NFTCollectionCoordinator: CanOpenURL {
func didPressViewContractWebPage(forContract contract: AlphaWallet.Address, server: RPCServer, in viewController: UIViewController) {
delegate?.didPressViewContractWebPage(forContract: contract, server: server, in: viewController)
}
@ -648,7 +648,7 @@ extension TokensCardCoordinator: CanOpenURL {
}
}
extension TokensCardCoordinator: StaticHTMLViewControllerDelegate {
extension NFTCollectionCoordinator: StaticHTMLViewControllerDelegate {
}
extension Collection where Element == TokenHolder {

@ -110,7 +110,7 @@ class SingleChainTokenCoordinator: Coordinator {
let activitiesFilterStrategy = transactionType.activitiesFilterStrategy
let activitiesService = self.activitiesService.copy(activitiesFilterStrategy: activitiesFilterStrategy, transactionsFilterStrategy: TransactionDataStore.functional.transactionsFilter(for: activitiesFilterStrategy, tokenObject: transactionType.tokenObject))
let tokensCardCoordinator = TokensCardCoordinator(
let coordinator = NFTCollectionCoordinator(
session: session,
navigationController: navigationController,
keystore: keystore,
@ -121,9 +121,9 @@ class SingleChainTokenCoordinator: Coordinator {
activitiesService: activitiesService
)
addCoordinator(tokensCardCoordinator)
tokensCardCoordinator.delegate = self
tokensCardCoordinator.start()
addCoordinator(coordinator)
coordinator.delegate = self
coordinator.start()
}
func show(fungibleToken token: TokenObject, transactionType: TransactionType, navigationController: UINavigationController) {
@ -180,24 +180,24 @@ class SingleChainTokenCoordinator: Coordinator {
}
}
extension SingleChainTokenCoordinator: TokensCardCoordinatorDelegate {
func didTap(transaction: TransactionInstance, in coordinator: TokensCardCoordinator) {
extension SingleChainTokenCoordinator: NFTCollectionCoordinatorDelegate {
func didTap(transaction: TransactionInstance, in coordinator: NFTCollectionCoordinator) {
delegate?.didTap(transaction: transaction, inViewController: coordinator.rootViewController, in: self)
}
func didTap(activity: Activity, in coordinator: TokensCardCoordinator) {
func didTap(activity: Activity, in coordinator: NFTCollectionCoordinator) {
delegate?.didTap(activity: activity, inViewController: coordinator.rootViewController, in: self)
}
func didPress(for type: PaymentFlow, inViewController viewController: UIViewController, in coordinator: TokensCardCoordinator) {
func didPress(for type: PaymentFlow, inViewController viewController: UIViewController, in coordinator: NFTCollectionCoordinator) {
delegate?.didPress(for: type, inViewController: viewController, in: self)
}
func didCancel(in coordinator: TokensCardCoordinator) {
func didCancel(in coordinator: NFTCollectionCoordinator) {
removeCoordinator(coordinator)
}
func didPostTokenScriptTransaction(_ transaction: SentTransaction, in coordinator: TokensCardCoordinator) {
func didPostTokenScriptTransaction(_ transaction: SentTransaction, in coordinator: NFTCollectionCoordinator) {
delegate?.didPostTokenScriptTransaction(transaction, in: self)
}
}

Loading…
Cancel
Save