Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: navigation, codescanner #129

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LDKNodeMonday/App/LDKNodeMondayApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct LDKNodeMondayApp: App {
if isOnboarding {
OnboardingView(viewModel: .init())
} else {
StartView(viewModel: .init())
StartView(viewModel: .init(), navigationPath: $navigationPath)
}
}
.onChange(of: isOnboarding) { oldValue, newValue in
Expand Down
4 changes: 3 additions & 1 deletion LDKNodeMonday/View Model/Home/OnboardingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class OnboardingViewModel: ObservableObject {
try KeyClient.live.saveNetwork(selectedNetwork.description)
try KeyClient.live.saveEsploraURL(selectedURL)
LightningNodeService.shared = LightningNodeService()
self.isOnboarding = false
DispatchQueue.main.async {
self.isOnboarding = false
}
} catch let error as NodeError {
let errorString = handleNodeError(error)
DispatchQueue.main.async {
Expand Down
4 changes: 2 additions & 2 deletions LDKNodeMonday/View/Home/BitcoinView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct BitcoinView: View {
@State private var showingNodeIDView = false
@StateObject var viewModel: BitcoinViewModel
@StateObject private var eventService = EventService()
@State private var sendNavigationPath = NavigationPath()
@Binding var sendNavigationPath: NavigationPath

var body: some View {

Expand Down Expand Up @@ -346,6 +346,6 @@ enum NavigationDestination: Hashable {

#if DEBUG
#Preview {
BitcoinView(viewModel: .init(priceClient: .mock))
BitcoinView(viewModel: .init(priceClient: .mock), sendNavigationPath: .constant(.init()))
}
#endif
8 changes: 6 additions & 2 deletions LDKNodeMonday/View/Home/Send/AddressView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,12 @@ struct CustomScannerView: View {
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .top) {
CodeScannerView(codeTypes: codeTypes, completion: completion)
.edgesIgnoringSafeArea(.all)
CodeScannerView(
codeTypes: codeTypes,
shouldVibrateOnSuccess: true,
completion: completion
)
.edgesIgnoringSafeArea(.all)

VStack {
HStack {
Expand Down
10 changes: 7 additions & 3 deletions LDKNodeMonday/View/Home/StartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct StartView: View {
@ObservedObject var viewModel: StartViewModel
@State private var showingStartViewErrorAlert = false
@State var startViewError: MondayError?
@Binding var navigationPath: NavigationPath

var body: some View {

Expand All @@ -21,8 +22,11 @@ struct StartView: View {
.ignoresSafeArea()

if viewModel.isStarted {
BitcoinView(viewModel: .init(priceClient: .live))
.edgesIgnoringSafeArea(.all)
BitcoinView(
viewModel: .init(priceClient: .live),
sendNavigationPath: $navigationPath
)
.edgesIgnoringSafeArea(.all)
} else {
VStack(spacing: 20) {
Image(systemName: "bolt.horizontal")
Expand Down Expand Up @@ -90,6 +94,6 @@ struct StartView: View {

#if DEBUG
#Preview {
StartView(viewModel: .init())
StartView(viewModel: .init(), navigationPath: .constant(.init()))
}
#endif
Loading