Convert wallet NavigationLinks

This commit is contained in:
Scott Penrose
2023-06-03 13:47:50 -04:00
committed by William Casarin
parent c50ccef56d
commit f361f55bd5
4 changed files with 22 additions and 7 deletions

View File

@@ -49,7 +49,7 @@ struct SideMenuView: View {
navLabel(title: NSLocalizedString("Profile", comment: "Sidebar menu label for Profile view."), img: "user")
}
NavigationLink(destination: WalletView(damus_state: damus_state, model: damus_state.wallet)) {
NavigationLink(value: Route.Wallet(wallet: damus_state.wallet)) {
navLabel(title: NSLocalizedString("Wallet", comment: "Sidebar menu label for Wallet view."), img: "wallet")
/*
HStack {

View File

@@ -9,6 +9,7 @@ import SwiftUI
struct ConnectWalletView: View {
@Environment(\.openURL) private var openURL
@EnvironmentObject var navigationCoordinator: NavigationCoordinator
@ObservedObject var model: WalletModel
@State var scanning: Bool = false
@@ -63,17 +64,13 @@ struct ConnectWalletView: View {
}
var ConnectWallet: some View {
VStack {
NavigationLink(destination: WalletScannerView(result: $wallet_scan_result), isActive: $scanning) {
EmptyView()
}
VStack {
AlbyButton() {
openURL(URL(string:"https://nwc.getalby.com/apps/new?c=Damus")!)
}
BigButton(NSLocalizedString("Attach Wallet", comment: "Text for button to attach Nostr Wallet Connect lightning wallet.")) {
scanning = true
navigationCoordinator.push(route: Route.WalletScanner(result: $wallet_scan_result))
}
if let err = self.error {

View File

@@ -11,6 +11,7 @@ struct WalletView: View {
let damus_state: DamusState
@ObservedObject var model: WalletModel
@ObservedObject var settings: UserSettingsStore
@EnvironmentObject var navigationCoordinator: NavigationCoordinator
init(damus_state: DamusState, model: WalletModel? = nil) {
self.damus_state = damus_state
@@ -156,8 +157,10 @@ struct WalletView: View {
switch model.connect_state {
case .new:
ConnectWalletView(model: model)
.environmentObject(navigationCoordinator)
case .none:
ConnectWalletView(model: model)
.environmentObject(navigationCoordinator)
case .existing(let nwc):
MainWalletView(nwc: nwc)
.onAppear() {