mirror of
https://github.com/lil-org/wallet.git
synced 2024-12-28 06:59:34 +03:00
do not show navigation view on macos networks list
This commit is contained in:
parent
f3cf9786ab
commit
b24e106ad1
@ -14,21 +14,21 @@ struct NetworksListView: View {
|
||||
private let completion: ((EthereumNetwork?) -> Void)
|
||||
|
||||
var body: some View {
|
||||
#if os(iOS)
|
||||
NavigationView {
|
||||
VStack {
|
||||
List {
|
||||
networkSection(networks: pinned, title: Strings.pinned)
|
||||
networkSection(networks: mainnets)
|
||||
networkSection(networks: testnets, title: Strings.testnets)
|
||||
}
|
||||
list()
|
||||
}
|
||||
.navigationBarTitle(Strings.selectNetwork, displayMode: .large)
|
||||
.navigationBarItems(leading: Button(action: {
|
||||
completion(selectedNetwork)
|
||||
presentationMode.wrappedValue.dismiss() }) {
|
||||
Text(Strings.done).bold()
|
||||
}.disabled(selectedNetwork == nil))
|
||||
}.disabled(selectedNetwork == nil))
|
||||
}
|
||||
#elseif os(macOS)
|
||||
list()
|
||||
#endif
|
||||
}
|
||||
|
||||
init(selectedNetwork: EthereumNetwork?, completion: @escaping ((EthereumNetwork?) -> Void)) {
|
||||
@ -36,6 +36,15 @@ struct NetworksListView: View {
|
||||
self.completion = completion
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func list() -> some View {
|
||||
List {
|
||||
networkSection(networks: pinned, title: Strings.pinned)
|
||||
networkSection(networks: mainnets)
|
||||
networkSection(networks: testnets, title: Strings.testnets)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func networkSection(networks: [EthereumNetwork], title: String? = nil) -> some View {
|
||||
Section(header: title.map { Text($0) }) {
|
||||
@ -47,13 +56,13 @@ struct NetworksListView: View {
|
||||
Image.checkmark.foregroundStyle(.selection)
|
||||
}
|
||||
}.frame(maxWidth: .infinity, maxHeight: .infinity).contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
if selectedNetwork?.chainId == network.chainId {
|
||||
selectedNetwork = nil
|
||||
} else {
|
||||
selectedNetwork = network
|
||||
.onTapGesture {
|
||||
if selectedNetwork?.chainId == network.chainId {
|
||||
selectedNetwork = nil
|
||||
} else {
|
||||
selectedNetwork = network
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user