From 4a88ee2ce456328494b11fffe3f45583573d0cc8 Mon Sep 17 00:00:00 2001 From: Tony Freeman Date: Mon, 13 May 2024 19:29:13 +0300 Subject: [PATCH] Update deprecated NavigationLink --- .../Archive/Category/CategoryView.swift | 3 +-- .../Deleted/CategoryDeletedView.swift | 3 +-- .../Archive/NFCEditor/NFCEditorView.swift | 3 +-- .../Archive/Search/ArchiveSearchView.swift | 8 +++---- Flipper/Packages/UI/Sources/Hub/HubView.swift | 22 +++++++++++-------- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Flipper/Packages/UI/Sources/Archive/Category/CategoryView.swift b/Flipper/Packages/UI/Sources/Archive/Category/CategoryView.swift index 46d12a06..2d437107 100644 --- a/Flipper/Packages/UI/Sources/Archive/Category/CategoryView.swift +++ b/Flipper/Packages/UI/Sources/Archive/Category/CategoryView.swift @@ -27,8 +27,7 @@ struct CategoryView: View { } .padding(14) } - - NavigationLink("", isActive: $showInfoView) { + .navigationDestination(isPresented: $showInfoView) { if let selectedItem { InfoView(item: selectedItem) } diff --git a/Flipper/Packages/UI/Sources/Archive/Category/Deleted/CategoryDeletedView.swift b/Flipper/Packages/UI/Sources/Archive/Category/Deleted/CategoryDeletedView.swift index 2bd40677..da0abca0 100644 --- a/Flipper/Packages/UI/Sources/Archive/Category/Deleted/CategoryDeletedView.swift +++ b/Flipper/Packages/UI/Sources/Archive/Category/Deleted/CategoryDeletedView.swift @@ -36,8 +36,7 @@ struct CategoryDeletedView: View { } .padding(14) } - - NavigationLink("", isActive: $showDeletedView) { + .navigationDestination(isPresented: $showDeletedView) { if let selectedItem { DeletedInfoView(item: selectedItem) } diff --git a/Flipper/Packages/UI/Sources/Archive/NFCEditor/NFCEditorView.swift b/Flipper/Packages/UI/Sources/Archive/NFCEditor/NFCEditorView.swift index 4a29f4f9..c322b14f 100644 --- a/Flipper/Packages/UI/Sources/Archive/NFCEditor/NFCEditorView.swift +++ b/Flipper/Packages/UI/Sources/Archive/NFCEditor/NFCEditorView.swift @@ -62,8 +62,7 @@ struct NFCEditorView: View { } .padding(14) } - - NavigationLink("", isActive: $showSaveAs) { + .navigationDestination(isPresented: $showSaveAs) { SaveAsView(item: $item) .onDisappear { dismiss() diff --git a/Flipper/Packages/UI/Sources/Archive/Search/ArchiveSearchView.swift b/Flipper/Packages/UI/Sources/Archive/Search/ArchiveSearchView.swift index 91062d9f..8d92a6f8 100644 --- a/Flipper/Packages/UI/Sources/Archive/Search/ArchiveSearchView.swift +++ b/Flipper/Packages/UI/Sources/Archive/Search/ArchiveSearchView.swift @@ -37,11 +37,9 @@ struct ArchiveSearchView: View { .customBackground(.background) } } - .background { - NavigationLink("", isActive: $showInfoView) { - if let selectedItem { - InfoView(item: selectedItem) - } + .navigationDestination(isPresented: $showInfoView) { + if let selectedItem { + InfoView(item: selectedItem) } } } diff --git a/Flipper/Packages/UI/Sources/Hub/HubView.swift b/Flipper/Packages/UI/Sources/Hub/HubView.swift index 7aca7451..238cbb20 100644 --- a/Flipper/Packages/UI/Sources/Hub/HubView.swift +++ b/Flipper/Packages/UI/Sources/Hub/HubView.swift @@ -27,13 +27,18 @@ struct HubView: View { NavigationStack { ScrollView { VStack(spacing: 14) { - NavigationLink(isActive: $appsState.showApplications) { - AppsView(selectedSegment: $appsState.selectedSegment) - .environmentObject(applications) + Button { + appsState.showApplications = true } label: { AppsRowCard() .environmentObject(applications) } + .navigationDestination( + isPresented: $appsState.showApplications + ) { + AppsView(selectedSegment: $appsState.selectedSegment) + .environmentObject(applications) + } .onReceive(router.showApps) { appsState.selectedSegment = .installed appsState.showApplications = true @@ -58,12 +63,6 @@ struct HubView: View { } } .padding(14) - - NavigationLink("", isActive: $appsState.showApplication) { - if let applicationAlias = appsState.applicationAlias{ - AppView(alias: applicationAlias) - } - } } .background(Color.background) .navigationBarBackground(Color.a1) @@ -92,6 +91,11 @@ struct HubView: View { .fullScreenCover(isPresented: $showDetectReader) { DetectReaderView() } + .navigationDestination(isPresented: $appsState.showApplication) { + if let applicationAlias = appsState.applicationAlias{ + AppView(alias: applicationAlias) + } + } } struct NFCCard: View {