diff --git a/Podfile.lock b/Podfile.lock index 3b96ed150b..69476cd02d 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -519,13 +519,13 @@ CHECKOUT OPTIONS: :commit: 5ce8892ad352d5eb837742cb17a94fd2a561ef73 :git: https://github.com/horizontalsystems/bitcoin-kit-ios.git Erc20Kit.swift: - :commit: 28d74a16b9ed7780c7d49babb597ccac4e9c66fa + :commit: aa1dd69a938d0ec0d418a2b007316fa659f3b205 :git: https://github.com/horizontalsystems/ethereum-kit-ios EthereumABI: :commit: f77b49868885e9f909bd7dcf4c50c42e84f43ef7 :git: https://github.com/horizontalsystems/EthereumABI EthereumKit.swift: - :commit: 28d74a16b9ed7780c7d49babb597ccac4e9c66fa + :commit: aa1dd69a938d0ec0d418a2b007316fa659f3b205 :git: https://github.com/horizontalsystems/ethereum-kit-ios FeeRateKit.swift: :commit: 763394a92bdf091517376776bccecf9e7edbb49f @@ -555,7 +555,7 @@ CHECKOUT OPTIONS: :commit: 1ba3514ba9bbb649f02402d10570b0ef0de2407c :git: https://github.com/horizontalsystems/component-kit-ios/ OneInchKit.swift: - :commit: 28d74a16b9ed7780c7d49babb597ccac4e9c66fa + :commit: aa1dd69a938d0ec0d418a2b007316fa659f3b205 :git: https://github.com/horizontalsystems/ethereum-kit-ios PinKit.swift: :commit: 44162b713df1858b02640b93e3b75bfbbaa4a3f2 @@ -576,7 +576,7 @@ CHECKOUT OPTIONS: :commit: 3b1886c03600c421a0591cff3259013da606524e :git: https://github.com/horizontalsystems/gui-kit/ UniswapKit.swift: - :commit: 28d74a16b9ed7780c7d49babb597ccac4e9c66fa + :commit: aa1dd69a938d0ec0d418a2b007316fa659f3b205 :git: https://github.com/horizontalsystems/ethereum-kit-ios WalletConnect: :commit: 1336f67877608e271107cd96bb852f76fd51eddf diff --git a/UnstoppableWallet/UnstoppableWallet/Models/EvmNetwork.swift b/UnstoppableWallet/UnstoppableWallet/Models/EvmNetwork.swift index d509d36651..ba81e622c8 100644 --- a/UnstoppableWallet/UnstoppableWallet/Models/EvmNetwork.swift +++ b/UnstoppableWallet/UnstoppableWallet/Models/EvmNetwork.swift @@ -12,7 +12,7 @@ class EvmNetwork { } var id: String { - "\(networkType.chainId)|\(syncSource.url.absoluteString)" + "\(networkType.chainId)|\(syncSource.urls.map({ $0.absoluteString }).joined(separator: ","))" } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/EvmNetwork/EvmNetworkViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/EvmNetwork/EvmNetworkViewController.swift index 58a9750892..6d506c201d 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/EvmNetwork/EvmNetworkViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/EvmNetwork/EvmNetworkViewController.swift @@ -40,6 +40,7 @@ class EvmNetworkViewController: ThemeViewController { tableView.registerCell(forClass: F4Cell.self) tableView.registerHeaderFooter(forClass: SubtitleHeaderFooterView.self) + tableView.registerHeaderFooter(forClass: TopDescriptionHeaderFooterView.self) tableView.sectionDataSource = self subscribe(disposeBag, viewModel.sectionViewItemsDriver) { [weak self] sectionViewItems in @@ -77,10 +78,20 @@ extension EvmNetworkViewController: SectionsDataSource { } private func section(sectionViewItem: EvmNetworkViewModel.SectionViewItem) -> SectionProtocol { - Section( + let containerWidth: CGFloat = tableView.bounds.width + + let footerState: ViewState = sectionViewItem.description.flatMap { descriptionText in + .cellType(hash: "bottom_description", binder: { view in + view.bind(text: descriptionText) + }, dynamicHeight: { [weak self] _ in + TopDescriptionHeaderFooterView.height(containerWidth: containerWidth, text: descriptionText) + }) + } ?? .margin(height: .margin32) + + return Section( id: sectionViewItem.title, headerState: header(text: sectionViewItem.title), - footerState: .margin(height: .margin32), + footerState: footerState, rows: sectionViewItem.viewItems.enumerated().map { index, viewItem in let isFirst = index == 0 let isLast = index == sectionViewItem.viewItems.count - 1 diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/EvmNetwork/EvmNetworkViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/EvmNetwork/EvmNetworkViewModel.swift index dddd0beb2e..2ca9a4ad3d 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/EvmNetwork/EvmNetworkViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/EvmNetwork/EvmNetworkViewModel.swift @@ -22,26 +22,35 @@ class EvmNetworkViewModel { let testNetItems = items.filter { !$0.mainNet } let sectionViewItems: [SectionViewItem?] = [ - sectionViewItem(title: "MainNet", viewItems: mainNetItems.map { viewItem(item: $0) }), - sectionViewItem(title: "TestNet", viewItems: testNetItems.map { viewItem(item: $0) }) + sectionViewItem(title: "MainNet", items: mainNetItems), + sectionViewItem(title: "TestNet", items: testNetItems) ] sectionViewItemsRelay.accept(sectionViewItems.compactMap { $0 }) } - private func sectionViewItem(title: String, viewItems: [ViewItem]) -> SectionViewItem? { + private func sectionViewItem(title: String, items: [EvmNetworkService.Item]) -> SectionViewItem? { + let viewItems = items.map { viewItem(item: $0) } guard !viewItems.isEmpty else { return nil } - return SectionViewItem(title: title, viewItems: viewItems) + var description: String? = nil + + if let selectedItem = items.first(where: { $0.selected }), + selectedItem.network.syncSource.urls.count > 1 { + let links = selectedItem.network.syncSource.urls.map({ " • \($0.absoluteString)" }).joined(separator: "\n") + description = "\("evm_network.description".localized)\n\n\(links)" + } + + return SectionViewItem(title: title, viewItems: viewItems, description: description) } private func viewItem(item: EvmNetworkService.Item) -> ViewItem { ViewItem( id: item.network.id, name: item.network.name, - url: item.network.syncSource.url.absoluteString, + url: item.network.syncSource.urls.count == 1 ? item.network.syncSource.urls[0].absoluteString : "evm_network.switches_automatically".localized, selected: item.selected ) } @@ -77,6 +86,7 @@ extension EvmNetworkViewModel { struct SectionViewItem { let title: String let viewItems: [ViewItem] + let description: String? } struct ViewItem { diff --git a/UnstoppableWallet/UnstoppableWallet/de.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/de.lproj/Localizable.strings index 1ba9258091..d21a4e918e 100644 --- a/UnstoppableWallet/UnstoppableWallet/de.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/de.lproj/Localizable.strings @@ -1039,3 +1039,8 @@ Wir haben Unstoppable für uns selbst entwickelt, da die verfügbaren Lösungen // Network Settings "network_settings.title" = "Netzwerkeinstellungen"; + +// EVM Network + +"evm_network.switches_automatically" = "switches automatically"; +"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically."; diff --git a/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings index abf8cf3579..48c8689da4 100644 --- a/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings @@ -1042,3 +1042,8 @@ We built Unstoppable for ourselves as the other available solutions were not up // Network Settings "network_settings.title" = "Network Settings"; + +// EVM Network + +"evm_network.switches_automatically" = "switches automatically"; +"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically."; diff --git a/UnstoppableWallet/UnstoppableWallet/es.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/es.lproj/Localizable.strings index 00763cf022..0262304512 100644 --- a/UnstoppableWallet/UnstoppableWallet/es.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/es.lproj/Localizable.strings @@ -1040,3 +1040,8 @@ poner en peligro la seguridad de mis fondos."; // Network Settings "network_settings.title" = "Configuración de Red"; + +// EVM Network + +"evm_network.switches_automatically" = "switches automatically"; +"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically."; diff --git a/UnstoppableWallet/UnstoppableWallet/fr.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/fr.lproj/Localizable.strings index ded5faa4a0..5310b68916 100644 --- a/UnstoppableWallet/UnstoppableWallet/fr.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/fr.lproj/Localizable.strings @@ -1039,3 +1039,8 @@ Nous avons construit Unstoppable à notre intention car les solutions disponible // Network Settings "network_settings.title" = "Paramètres réseau"; + +// EVM Network + +"evm_network.switches_automatically" = "switches automatically"; +"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically."; diff --git a/UnstoppableWallet/UnstoppableWallet/ko.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/ko.lproj/Localizable.strings index 6b195dca15..c7cb7f1d82 100644 --- a/UnstoppableWallet/UnstoppableWallet/ko.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/ko.lproj/Localizable.strings @@ -1039,3 +1039,8 @@ Unstoppable 지갑은 완전한 오픈소스여서 누구나 앱이 요구하는 // Network Settings "network_settings.title" = "네트워크 설정"; + +// EVM Network + +"evm_network.switches_automatically" = "switches automatically"; +"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically."; diff --git a/UnstoppableWallet/UnstoppableWallet/ru.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/ru.lproj/Localizable.strings index a0cf031a23..f5f2632699 100644 --- a/UnstoppableWallet/UnstoppableWallet/ru.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/ru.lproj/Localizable.strings @@ -1041,3 +1041,8 @@ // Network Settings "network_settings.title" = "Настройки Сети"; + +// EVM Network + +"evm_network.switches_automatically" = "switches automatically"; +"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically."; diff --git a/UnstoppableWallet/UnstoppableWallet/tr.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/tr.lproj/Localizable.strings index 67e7e92e33..b40790e268 100644 --- a/UnstoppableWallet/UnstoppableWallet/tr.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/tr.lproj/Localizable.strings @@ -1042,3 +1042,8 @@ Mevcut çözümler yeterli olmadığından kendimiz için Durdurulamaz'ı geliş // Network Settings "network_settings.title" = "Ağ Ayarları"; + +// EVM Network + +"evm_network.switches_automatically" = "switches automatically"; +"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically."; diff --git a/UnstoppableWallet/UnstoppableWallet/zh.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/zh.lproj/Localizable.strings index 63e46333f0..375d342113 100644 --- a/UnstoppableWallet/UnstoppableWallet/zh.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/zh.lproj/Localizable.strings @@ -1041,3 +1041,8 @@ Unstoppable钱包完全开源且任何人都可以确定应用按照其宣称的 // Network Settings "network_settings.title" = "网络设置"; + +// EVM Network + +"evm_network.switches_automatically" = "switches automatically"; +"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically.";