diff --git a/novawallet.xcodeproj/project.pbxproj b/novawallet.xcodeproj/project.pbxproj index dc9f8a472e..40a2781f1c 100644 --- a/novawallet.xcodeproj/project.pbxproj +++ b/novawallet.xcodeproj/project.pbxproj @@ -1029,6 +1029,8 @@ 2D6F51A72CDD035900564C00 /* AssetDecorationAttributesFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F51A62CDD035900564C00 /* AssetDecorationAttributesFactory.swift */; }; 2D6F51A92CDD2C3100564C00 /* AssetListFlowLayout+Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F51A82CDD2C3100564C00 /* AssetListFlowLayout+Types.swift */; }; 2D6F51AB2CDDD98300564C00 /* AssetsSearchFlowLayout+Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F51AA2CDDD98300564C00 /* AssetsSearchFlowLayout+Types.swift */; }; + 2D6F51B12CE11EB100564C00 /* SpendAssetOperationNetworkBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F51B02CE11EB100564C00 /* SpendAssetOperationNetworkBuilder.swift */; }; + 2D6F51B32CE120AB00564C00 /* SpendAssetOperationNetworkListInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F51B22CE120AB00564C00 /* SpendAssetOperationNetworkListInteractor.swift */; }; 2D7748772C89B5450059607B /* VoteCardViewModelFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D7748762C89B5450059607B /* VoteCardViewModelFactory.swift */; }; 2D7748802C8B48C40059607B /* CIKeys.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D77487F2C8B48C40059607B /* CIKeys.generated.swift */; }; 2D7748822C8CFB0B0059607B /* ReferendumAmountOperationFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D7748812C8CFB0B0059607B /* ReferendumAmountOperationFactory.swift */; }; @@ -1725,7 +1727,7 @@ 77CB33D72A3998FD00B6709A /* Array+Sort.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CB33D62A3998FC00B6709A /* Array+Sort.swift */; }; 77CBD39C2ABBA98900D646D6 /* AssetListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CBD39B2ABBA98900D646D6 /* AssetListModel.swift */; }; 77CBD39E2ABC28BE00D646D6 /* SendAssetsOperationInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CBD39D2ABC28BE00D646D6 /* SendAssetsOperationInteractor.swift */; }; - 77CBD3A02ABC35D900D646D6 /* SendAssetSearchBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CBD39F2ABC35D900D646D6 /* SendAssetSearchBuilder.swift */; }; + 77CBD3A02ABC35D900D646D6 /* SpendAssetSearchBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CBD39F2ABC35D900D646D6 /* SpendAssetSearchBuilder.swift */; }; 77CC82A32A984BC3002D022F /* StartStakingSelectedValidatorsListWireframe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CC82A22A984BC3002D022F /* StartStakingSelectedValidatorsListWireframe.swift */; }; 77CC82A52A984EDA002D022F /* UINavigaionController+Pop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CC82A42A984EDA002D022F /* UINavigaionController+Pop.swift */; }; 77CC82A72A986CF1002D022F /* StakingSelectValidatorsDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CC82A62A986CF1002D022F /* StakingSelectValidatorsDelegate.swift */; }; @@ -6218,6 +6220,8 @@ 2D6F51A62CDD035900564C00 /* AssetDecorationAttributesFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetDecorationAttributesFactory.swift; sourceTree = ""; }; 2D6F51A82CDD2C3100564C00 /* AssetListFlowLayout+Types.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AssetListFlowLayout+Types.swift"; sourceTree = ""; }; 2D6F51AA2CDDD98300564C00 /* AssetsSearchFlowLayout+Types.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AssetsSearchFlowLayout+Types.swift"; sourceTree = ""; }; + 2D6F51B02CE11EB100564C00 /* SpendAssetOperationNetworkBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpendAssetOperationNetworkBuilder.swift; sourceTree = ""; }; + 2D6F51B22CE120AB00564C00 /* SpendAssetOperationNetworkListInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpendAssetOperationNetworkListInteractor.swift; sourceTree = ""; }; 2D7748762C89B5450059607B /* VoteCardViewModelFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoteCardViewModelFactory.swift; sourceTree = ""; }; 2D77487F2C8B48C40059607B /* CIKeys.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CIKeys.generated.swift; sourceTree = SOURCE_ROOT; }; 2D7748812C8CFB0B0059607B /* ReferendumAmountOperationFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReferendumAmountOperationFactory.swift; sourceTree = ""; }; @@ -6856,7 +6860,7 @@ 77CB33D62A3998FC00B6709A /* Array+Sort.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Array+Sort.swift"; sourceTree = ""; }; 77CBD39B2ABBA98900D646D6 /* AssetListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetListModel.swift; sourceTree = ""; }; 77CBD39D2ABC28BE00D646D6 /* SendAssetsOperationInteractor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendAssetsOperationInteractor.swift; sourceTree = ""; }; - 77CBD39F2ABC35D900D646D6 /* SendAssetSearchBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendAssetSearchBuilder.swift; sourceTree = ""; }; + 77CBD39F2ABC35D900D646D6 /* SpendAssetSearchBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpendAssetSearchBuilder.swift; sourceTree = ""; }; 77CC82A22A984BC3002D022F /* StartStakingSelectedValidatorsListWireframe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StartStakingSelectedValidatorsListWireframe.swift; sourceTree = ""; }; 77CC82A42A984EDA002D022F /* UINavigaionController+Pop.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigaionController+Pop.swift"; sourceTree = ""; }; 77CC82A62A986CF1002D022F /* StakingSelectValidatorsDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StakingSelectValidatorsDelegate.swift; sourceTree = ""; }; @@ -10697,7 +10701,7 @@ isa = PBXGroup; children = ( 0C1FE4F32A52EE51003769E7 /* AssetSearchBuilder.swift */, - 77CBD39F2ABC35D900D646D6 /* SendAssetSearchBuilder.swift */, + 77CBD39F2ABC35D900D646D6 /* SpendAssetSearchBuilder.swift */, 0C1FE4F52A52F137003769E7 /* AssetSearchBuilderResult.swift */, ); path = Model; @@ -12650,6 +12654,7 @@ 2D4F55202CCBE18400B65B76 /* AssetOperationNetworkListViewModelFactory.swift */, 2D4F552B2CCC383100B65B76 /* AssetOperationNetworkViewModel.swift */, 2D4F55222CCBE58000B65B76 /* AssetOperationNetworkBuilder.swift */, + 2D6F51B02CE11EB100564C00 /* SpendAssetOperationNetworkBuilder.swift */, ); path = Model; sourceTree = ""; @@ -12840,6 +12845,15 @@ path = AssetListStyleSwitcher; sourceTree = ""; }; + 2D6F51B42CE120AF00564C00 /* Interactor */ = { + isa = PBXGroup; + children = ( + 3C3ADD92DEC7B0142C5C6696 /* AssetOperationNetworkListInteractor.swift */, + 2D6F51B22CE120AB00564C00 /* SpendAssetOperationNetworkListInteractor.swift */, + ); + path = Interactor; + sourceTree = ""; + }; 2D77488A2C9042800059607B /* Model */ = { isa = PBXGroup; children = ( @@ -22853,9 +22867,9 @@ 2D4F55302CCC38FB00B65B76 /* Model */, 2D4F55242CCBFC2D00B65B76 /* View */, 2D4F553C2CCC5DA400B65B76 /* Presenter */, + 2D6F51B42CE120AF00564C00 /* Interactor */, 699926F12D454980392BAF03 /* AssetOperationNetworkListProtocols.swift */, 3C402A458F6B80E4CD6DBFE3 /* AssetOperationNetworkListWireframe.swift */, - 3C3ADD92DEC7B0142C5C6696 /* AssetOperationNetworkListInteractor.swift */, 891FBCE49A51A9120ED9F861 /* AssetOperationNetworkListViewController.swift */, B54E04B6D25A2DCD254CF1C4 /* AssetOperationNetworkListViewLayout.swift */, 3E646AC94F6AD246B0FD17EB /* AssetOperationNetworkListViewFactory.swift */, @@ -24835,7 +24849,7 @@ 846B749528B422C800C39B93 /* ChainAccountAddViewModel.swift in Sources */, 84EBFCE4285E734C0006327E /* XcmTransferDestination.swift in Sources */, 0CD8462E2BDE10C20026B5CA /* OnboardingImportOptionsPresenter.swift in Sources */, - 77CBD3A02ABC35D900D646D6 /* SendAssetSearchBuilder.swift in Sources */, + 77CBD3A02ABC35D900D646D6 /* SpendAssetSearchBuilder.swift in Sources */, AE805FC726B3E54E00007CE9 /* YourValidatorInfoInteractor.swift in Sources */, 844DBC69274E3422009F8351 /* AccountImportSeedView.swift in Sources */, 84644AC52567EC05004EAA4B /* MultilineTriangularedView.swift in Sources */, @@ -27349,6 +27363,7 @@ 8427495728FEBFA400B2B70B /* ConvictionVoting+ConstantPath.swift in Sources */, 845B823829C9031800D187CB /* EtherscanPagination.swift in Sources */, 84C5ADDF28133F3E006D7388 /* UnknownAddressView.swift in Sources */, + 2D6F51B12CE11EB100564C00 /* SpendAssetOperationNetworkBuilder.swift in Sources */, 84F6B6502619E1ED0038F10D /* Int+Operations.swift in Sources */, 8487010E2907DF2F00F2C0C3 /* MultiValueView+Style.swift in Sources */, 84770F2A291F864500852A33 /* GovernanceUnlockInitData.swift in Sources */, @@ -27666,6 +27681,7 @@ 270C21973CB61F0BF3D2D1E3 /* CrowdloanListProtocols.swift in Sources */, 6D61E43A79BDF5EA6CA9E85D /* CrowdloanListWireframe.swift in Sources */, A090FF206B56A0E465C62072 /* CrowdloanListPresenter.swift in Sources */, + 2D6F51B32CE120AB00564C00 /* SpendAssetOperationNetworkListInteractor.swift in Sources */, 846CA7802709A41E0011124C /* StakingAnalyticsLocalSubscriptionHandler.swift in Sources */, 849DF02D26C40B7900B702F4 /* RuntimeFilesOperationFactory.swift in Sources */, 2DCC87672C5989CC0028C3CA /* CloudBackupCreateViewFactory+NewBackup.swift in Sources */, diff --git a/novawallet/Modules/AssetList/AssetListViewController.swift b/novawallet/Modules/AssetList/AssetListViewController.swift index ad6ee5c6e1..264b098f5e 100644 --- a/novawallet/Modules/AssetList/AssetListViewController.swift +++ b/novawallet/Modules/AssetList/AssetListViewController.swift @@ -228,6 +228,7 @@ extension AssetListViewController: AssetListCollectionManagerDelegate { extension AssetListViewController: Localizable { func applyLocalization() { if isViewLoaded { + collectionViewManager.updateSelectedLocale(with: selectedLocale) rootView.collectionView.reloadData() } } diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/AssetOperationNetworkListViewFactory.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/AssetOperationNetworkListViewFactory.swift index 0c37a9cc85..3b5a04dc4d 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/AssetOperationNetworkListViewFactory.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/AssetOperationNetworkListViewFactory.swift @@ -13,7 +13,7 @@ struct AssetOperationNetworkListViewFactory { let logger = Logger.shared - let interactor = AssetOperationNetworkListInteractor( + let interactor = SpendAssetOperationNetworkListInteractor( multichainToken: multichainToken, stateObservable: stateObservable, logger: logger @@ -52,7 +52,8 @@ struct AssetOperationNetworkListViewFactory { interactor: dependencies.interactor, wireframe: wireframe, multichainToken: dependencies.multichainToken, - viewModelFactory: viewModelFactory + viewModelFactory: viewModelFactory, + localizationManager: LocalizationManager.shared ) } @@ -129,7 +130,8 @@ extension AssetOperationNetworkListViewFactory { multichainToken: dependencies.multichainToken, viewModelFactory: viewModelFactory, selectedAccount: dependencies.selectedAccount, - purchaseProvider: dependencies.purchaseProvider + purchaseProvider: dependencies.purchaseProvider, + localizationManager: LocalizationManager.shared ) } } @@ -184,7 +186,8 @@ extension AssetOperationNetworkListViewFactory { wireframe: wireframe, multichainToken: dependencies.multichainToken, viewModelFactory: viewModelFactory, - selectedAccount: dependencies.selectedAccount + selectedAccount: dependencies.selectedAccount, + localizationManager: LocalizationManager.shared ) } } @@ -204,7 +207,7 @@ extension AssetOperationNetworkListViewFactory { let logger = Logger.shared - let interactor = AssetOperationNetworkListInteractor( + let interactor = SpendAssetOperationNetworkListInteractor( multichainToken: multichainToken, stateObservable: stateObservable, logger: logger @@ -242,7 +245,8 @@ extension AssetOperationNetworkListViewFactory { multichainToken: dependencies.multichainToken, viewModelFactory: viewModelFactory, selectClosure: dependencies.selectClosure, - selectClosureStrategy: dependencies.selectClosureStrategy + selectClosureStrategy: dependencies.selectClosureStrategy, + localizationManager: LocalizationManager.shared ) } } diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/AssetOperationNetworkListInteractor.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Interactor/AssetOperationNetworkListInteractor.swift similarity index 75% rename from novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/AssetOperationNetworkListInteractor.swift rename to novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Interactor/AssetOperationNetworkListInteractor.swift index e3aa29063f..cb61cb0309 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/AssetOperationNetworkListInteractor.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Interactor/AssetOperationNetworkListInteractor.swift @@ -1,14 +1,14 @@ import UIKit import Operation_iOS -final class AssetOperationNetworkListInteractor { +class AssetOperationNetworkListInteractor { weak var presenter: AssetOperationNetworkListInteractorOutputProtocol? - private let workingQueueLabel: String = "com.nova.wallet.assets.networks.builder" - private let stateObservable: AssetListModelObservable - private let multichainToken: MultichainToken + let workingQueueLabel: String = "com.nova.wallet.assets.networks.builder" + let stateObservable: AssetListModelObservable + let multichainToken: MultichainToken - private let logger: LoggerProtocol + let logger: LoggerProtocol private var chainAssets: [ChainAsset] = [] @@ -23,6 +23,22 @@ final class AssetOperationNetworkListInteractor { self.stateObservable = stateObservable self.logger = logger } + + func createModelBuilder( + with chainAssets: [ChainAsset], + resultClosure: @escaping (AssetOperationNetworkBuilderResult?) -> Void + ) -> AssetOperationNetworkBuilder { + .init( + chainAssets: chainAssets, + workingQueue: .init( + label: workingQueueLabel, + qos: .userInteractive + ), + callbackQueue: .main, + callbackClosure: resultClosure, + logger: logger + ) + } } // MARK: AssetOperationNetworkListInteractorInputProtocol @@ -46,15 +62,9 @@ extension AssetOperationNetworkListInteractor: AssetOperationNetworkListInteract self?.presenter?.didReceive(result: result) } - builder = .init( - chainAssets: chainAssets, - workingQueue: .init( - label: workingQueueLabel, - qos: .userInteractive - ), - callbackQueue: .main, - callbackClosure: resultClosure, - logger: logger + builder = createModelBuilder( + with: chainAssets, + resultClosure: resultClosure ) builder?.apply(model: stateObservable.state.value) diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Interactor/SpendAssetOperationNetworkListInteractor.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Interactor/SpendAssetOperationNetworkListInteractor.swift new file mode 100644 index 0000000000..5bff522b84 --- /dev/null +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Interactor/SpendAssetOperationNetworkListInteractor.swift @@ -0,0 +1,20 @@ +import Foundation +import Operation_iOS + +final class SpendAssetOperationNetworkListInteractor: AssetOperationNetworkListInteractor { + override func createModelBuilder( + with chainAssets: [ChainAsset], + resultClosure: @escaping (AssetOperationNetworkBuilderResult?) -> Void + ) -> AssetOperationNetworkBuilder { + SpendAssetOperationNetworkBuilder( + chainAssets: chainAssets, + workingQueue: .init( + label: workingQueueLabel, + qos: .userInteractive + ), + callbackQueue: .main, + callbackClosure: resultClosure, + logger: logger + ) + } +} diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Model/AssetOperationNetworkListViewModelFactory.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Model/AssetOperationNetworkListViewModelFactory.swift index 8f7fb8c074..363df48b4a 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Model/AssetOperationNetworkListViewModelFactory.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Model/AssetOperationNetworkListViewModelFactory.swift @@ -32,7 +32,7 @@ private extension AssetOperationNetworkListViewModelFactory { let balanceValueString = if let priceData { balanceFactory.priceFromAmount( - asset.totalValue ?? .zero, + asset.totalAmountDecimal ?? .zero, priceData: priceData ).value(for: locale) } else { diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Model/SpendAssetOperationNetworkBuilder.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Model/SpendAssetOperationNetworkBuilder.swift new file mode 100644 index 0000000000..90aa237a08 --- /dev/null +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Model/SpendAssetOperationNetworkBuilder.swift @@ -0,0 +1,28 @@ +import Foundation +import BigInt + +class SpendAssetOperationNetworkBuilder: AssetOperationNetworkBuilder { + override func assetListState(from model: AssetListModel) -> AssetListState { + let chainAssets = model.allChains.flatMap { _, chain in + chain.assets.map { ChainAssetId(chainId: chain.chainId, assetId: $0.assetId) } + } + + let balanceResults = chainAssets.reduce(into: [ChainAssetId: Result]()) { + switch model.balances[$1] { + case let .success(amount): + $0[$1] = .success(amount.transferable) + case let .failure(error): + $0[$1] = .failure(error) + case .none: + $0[$1] = .success(0) + } + } + + return AssetListState( + priceResult: model.priceResult, + balanceResults: balanceResults, + allChains: model.allChains, + externalBalances: nil + ) + } +} diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/AssetOperationNetworkListPresenter.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/AssetOperationNetworkListPresenter.swift index 3b4f26072d..2353df2f86 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/AssetOperationNetworkListPresenter.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/AssetOperationNetworkListPresenter.swift @@ -14,11 +14,13 @@ class AssetOperationNetworkListPresenter { init( interactor: AssetOperationNetworkListInteractorInputProtocol, multichainToken: MultichainToken, - viewModelFactory: AssetOperationNetworkListViewModelFactory + viewModelFactory: AssetOperationNetworkListViewModelFactory, + localizationManager: LocalizationManagerProtocol ) { self.interactor = interactor self.multichainToken = multichainToken self.viewModelFactory = viewModelFactory + self.localizationManager = localizationManager } func provideTitle() { diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Buy/BuyOperationNetworkListPresenter.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Buy/BuyOperationNetworkListPresenter.swift index e81374acc2..7b97e9ec0b 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Buy/BuyOperationNetworkListPresenter.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Buy/BuyOperationNetworkListPresenter.swift @@ -1,4 +1,5 @@ import Foundation +import SoraFoundation class BuyOperationNetworkListPresenter: AssetOperationNetworkListPresenter, PurchaseFlowManaging { let selectedAccount: MetaAccountModel @@ -13,7 +14,8 @@ class BuyOperationNetworkListPresenter: AssetOperationNetworkListPresenter, Purc multichainToken: MultichainToken, viewModelFactory: AssetOperationNetworkListViewModelFactory, selectedAccount: MetaAccountModel, - purchaseProvider: PurchaseProviderProtocol + purchaseProvider: PurchaseProviderProtocol, + localizationManager: LocalizationManagerProtocol ) { self.selectedAccount = selectedAccount self.purchaseProvider = purchaseProvider @@ -22,7 +24,8 @@ class BuyOperationNetworkListPresenter: AssetOperationNetworkListPresenter, Purc super.init( interactor: interactor, multichainToken: multichainToken, - viewModelFactory: viewModelFactory + viewModelFactory: viewModelFactory, + localizationManager: localizationManager ) } diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Receive/ReceiveOperationNetworkListPresenter.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Receive/ReceiveOperationNetworkListPresenter.swift index 588ac1521d..e9b130766a 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Receive/ReceiveOperationNetworkListPresenter.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Receive/ReceiveOperationNetworkListPresenter.swift @@ -1,4 +1,5 @@ import Foundation +import SoraFoundation class ReceiveOperationNetworkListPresenter: AssetOperationNetworkListPresenter { let wireframe: ReceiveAssetOperationWireframeProtocol @@ -10,7 +11,8 @@ class ReceiveOperationNetworkListPresenter: AssetOperationNetworkListPresenter { wireframe: ReceiveAssetOperationWireframeProtocol, multichainToken: MultichainToken, viewModelFactory: AssetOperationNetworkListViewModelFactory, - selectedAccount: MetaAccountModel + selectedAccount: MetaAccountModel, + localizationManager: LocalizationManagerProtocol ) { self.selectedAccount = selectedAccount self.wireframe = wireframe @@ -18,7 +20,8 @@ class ReceiveOperationNetworkListPresenter: AssetOperationNetworkListPresenter { super.init( interactor: interactor, multichainToken: multichainToken, - viewModelFactory: viewModelFactory + viewModelFactory: viewModelFactory, + localizationManager: localizationManager ) } diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Send/SendOperationNetworkListPresenter.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Send/SendOperationNetworkListPresenter.swift index b2c3a61fc3..e1b555e920 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Send/SendOperationNetworkListPresenter.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Send/SendOperationNetworkListPresenter.swift @@ -1,4 +1,5 @@ import Foundation +import SoraFoundation class SendOperationNetworkListPresenter: AssetOperationNetworkListPresenter { let wireframe: SendAssetOperationWireframeProtocol @@ -7,14 +8,16 @@ class SendOperationNetworkListPresenter: AssetOperationNetworkListPresenter { interactor: AssetOperationNetworkListInteractorInputProtocol, wireframe: SendAssetOperationWireframeProtocol, multichainToken: MultichainToken, - viewModelFactory: AssetOperationNetworkListViewModelFactory + viewModelFactory: AssetOperationNetworkListViewModelFactory, + localizationManager: LocalizationManagerProtocol ) { self.wireframe = wireframe super.init( interactor: interactor, multichainToken: multichainToken, - viewModelFactory: viewModelFactory + viewModelFactory: viewModelFactory, + localizationManager: localizationManager ) } diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Swap/SwapOperationNetworkListPresenter.swift b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Swap/SwapOperationNetworkListPresenter.swift index 8289ec7e0a..3e7225bab1 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Swap/SwapOperationNetworkListPresenter.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/AssetOperationNetworkList/Presenter/Swap/SwapOperationNetworkListPresenter.swift @@ -1,4 +1,5 @@ import Foundation +import SoraFoundation class SwapOperationNetworkListPresenter: AssetOperationNetworkListPresenter { let wireframe: SwapAssetsOperationWireframeProtocol @@ -12,7 +13,8 @@ class SwapOperationNetworkListPresenter: AssetOperationNetworkListPresenter { multichainToken: MultichainToken, viewModelFactory: AssetOperationNetworkListViewModelFactory, selectClosure: @escaping (ChainAsset) -> Void, - selectClosureStrategy: SubmoduleNavigationStrategy + selectClosureStrategy: SubmoduleNavigationStrategy, + localizationManager: LocalizationManagerProtocol ) { self.wireframe = wireframe self.selectClosure = selectClosure @@ -21,7 +23,8 @@ class SwapOperationNetworkListPresenter: AssetOperationNetworkListPresenter { super.init( interactor: interactor, multichainToken: multichainToken, - viewModelFactory: viewModelFactory + viewModelFactory: viewModelFactory, + localizationManager: localizationManager ) } diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/Send/SendAssetsOperationInteractor.swift b/novawallet/Modules/AssetsSearch/AssetOperation/Send/SendAssetsOperationInteractor.swift index 00f9849700..03d8a758b0 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/Send/SendAssetsOperationInteractor.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/Send/SendAssetsOperationInteractor.swift @@ -9,7 +9,7 @@ final class SendAssetsOperationInteractor { let settingsManager: SettingsManagerProtocol let logger: LoggerProtocol - private var builder: SendAssetSearchBuilder? + private var builder: SpendAssetSearchBuilder? init( stateObservable: AssetListModelObservable, diff --git a/novawallet/Modules/AssetsSearch/AssetOperation/Swaps/SwapAssetsOperationInteractor.swift b/novawallet/Modules/AssetsSearch/AssetOperation/Swaps/SwapAssetsOperationInteractor.swift index e50a0dfc2c..6dfb37fcb6 100644 --- a/novawallet/Modules/AssetsSearch/AssetOperation/Swaps/SwapAssetsOperationInteractor.swift +++ b/novawallet/Modules/AssetsSearch/AssetOperation/Swaps/SwapAssetsOperationInteractor.swift @@ -13,7 +13,7 @@ final class SwapAssetsOperationInteractor: AnyCancellableCleaning { let settingsManager: SettingsManagerProtocol private let operationQueue: OperationQueue - private var builder: AssetSearchBuilder? + private var builder: SpendAssetSearchBuilder? private var directionsCall = CancellableCallStore() private var availableDirections: [ChainAssetId: Set] = [:] private var availableChains: Set = [] diff --git a/novawallet/Modules/AssetsSearch/Model/SendAssetSearchBuilder.swift b/novawallet/Modules/AssetsSearch/Model/SpendAssetSearchBuilder.swift similarity index 91% rename from novawallet/Modules/AssetsSearch/Model/SendAssetSearchBuilder.swift rename to novawallet/Modules/AssetsSearch/Model/SpendAssetSearchBuilder.swift index 9ab68c7e9f..c53c5a7c1e 100644 --- a/novawallet/Modules/AssetsSearch/Model/SendAssetSearchBuilder.swift +++ b/novawallet/Modules/AssetsSearch/Model/SpendAssetSearchBuilder.swift @@ -1,6 +1,6 @@ import BigInt -final class SendAssetSearchBuilder: AssetSearchBuilder { +final class SpendAssetSearchBuilder: AssetSearchBuilder { override func assetListState(from model: AssetListModel) -> AssetListState { let balanceResults = model.balances.reduce(into: [ChainAssetId: Result]()) { switch $1.value {