A few more navigation links from rebase
This commit is contained in:
committed by
William Casarin
parent
58a707685c
commit
69663b8207
@@ -282,6 +282,7 @@ struct ContentView: View {
|
||||
.tabViewStyle(.page(indexDisplayMode: .never))
|
||||
.overlay(
|
||||
SideMenuView(damus_state: damus, isSidebarVisible: $isSideBarOpened.animation())
|
||||
.environmentObject(navigationCoordinator)
|
||||
)
|
||||
.navigationDestination(for: Route.self) { route in
|
||||
route.view(navigationCordinator: navigationCoordinator, damusState: damus_state!)
|
||||
|
||||
@@ -38,6 +38,7 @@ enum Route: Hashable {
|
||||
case SaveKeys(account: CreateAccountModel)
|
||||
case Wallet(wallet: WalletModel)
|
||||
case WalletScanner(result: Binding<WalletScanResult>)
|
||||
case FollowersYouKnow(friendedFollowers: [String])
|
||||
|
||||
@ViewBuilder
|
||||
func view(navigationCordinator: NavigationCoordinator, damusState: DamusState) -> some View {
|
||||
@@ -115,6 +116,8 @@ enum Route: Hashable {
|
||||
.environmentObject(navigationCordinator)
|
||||
case .WalletScanner(let walletScanResult):
|
||||
WalletScannerView(result: walletScanResult)
|
||||
case .FollowersYouKnow(let friendedFollowers):
|
||||
FollowersYouKnowView(damus_state: damusState, friended_followers: friendedFollowers)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +183,8 @@ enum Route: Hashable {
|
||||
return true
|
||||
case (.WalletScanner(_), .WalletScanner(_)):
|
||||
return true
|
||||
case (.FollowersYouKnow(let lhs_friendedFollowers), .FollowersYouKnow(let rhs_friendedFollowers)):
|
||||
return lhs_friendedFollowers == rhs_friendedFollowers
|
||||
default:
|
||||
return false
|
||||
}
|
||||
@@ -263,6 +268,9 @@ enum Route: Hashable {
|
||||
hasher.combine("wallet")
|
||||
case .WalletScanner(_):
|
||||
hasher.combine("walletScanner")
|
||||
case .FollowersYouKnow(let friendedFollowers):
|
||||
hasher.combine("followersYouKnow")
|
||||
hasher.combine(friendedFollowers)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ struct ProfileView: View {
|
||||
if !friended_followers.isEmpty {
|
||||
Spacer()
|
||||
|
||||
NavigationLink(destination: FollowersYouKnowView(damus_state: damus_state, friended_followers: friended_followers)) {
|
||||
NavigationLink(value: Route.FollowersYouKnow(friendedFollowers: friended_followers)) {
|
||||
HStack {
|
||||
CondensedProfilePicturesView(state: damus_state, pubkeys: friended_followers, maxPictures: 3)
|
||||
Text(followedByString(friended_followers, profiles: damus_state.profiles))
|
||||
@@ -521,6 +521,7 @@ struct ProfileView: View {
|
||||
}
|
||||
.fullScreenCover(isPresented: $show_qr_code) {
|
||||
QRCodeView(damus_state: damus_state, pubkey: profile.pubkey)
|
||||
.environmentObject(navigationCoordinator)
|
||||
}
|
||||
|
||||
if damus_state.is_privkey_user {
|
||||
|
||||
@@ -45,12 +45,12 @@ struct QRCodeView: View {
|
||||
@State var pubkey: String
|
||||
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@EnvironmentObject var navigationCoordinator: NavigationCoordinator
|
||||
|
||||
@State private var selectedTab = 0
|
||||
|
||||
@State var scanResult: ProfileScanResult? = nil
|
||||
|
||||
@State var showProfileView: Bool = false
|
||||
|
||||
@State var profile: Profile? = nil
|
||||
@State var error: String? = nil
|
||||
|
||||
@@ -209,13 +209,6 @@ struct QRCodeView: View {
|
||||
|
||||
Spacer()
|
||||
|
||||
if let scanResult {
|
||||
let dst = ProfileView(damus_state: damus_state, pubkey: scanResult.pubkey)
|
||||
NavigationLink(destination: dst, isActive: $showProfileView) {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
@@ -271,9 +264,10 @@ struct QRCodeView: View {
|
||||
|
||||
func show_profile_after_delay() {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + animationDuration) {
|
||||
showProfileView = true
|
||||
if let scanResult {
|
||||
navigationCoordinator.push(route: Route.ProfileByKey(pubkey: scanResult.pubkey))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func cameraAnimate(completion: @escaping () -> Void) {
|
||||
|
||||
@@ -42,9 +42,7 @@ struct RecommendedRelayView: View {
|
||||
Text(relay).layoutPriority(1)
|
||||
|
||||
if let meta = damus.relay_metadata.lookup(relay_id: relay) {
|
||||
NavigationLink ( destination:
|
||||
RelayDetailView(state: damus, relay: relay, nip11: meta)
|
||||
){
|
||||
NavigationLink(value: Route.RelayDetail(relay: relay, metadata: meta)){
|
||||
EmptyView()
|
||||
}
|
||||
.opacity(0.0)
|
||||
|
||||
@@ -15,6 +15,7 @@ struct SideMenuView: View {
|
||||
@State private var showQRCode = false
|
||||
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
@EnvironmentObject var navigationCoordinator: NavigationCoordinator
|
||||
|
||||
var sideBarWidth = min(UIScreen.main.bounds.size.width * 0.65, 400.0)
|
||||
let verticalSpacing: CGFloat = 20
|
||||
@@ -161,6 +162,7 @@ struct SideMenuView: View {
|
||||
.dynamicTypeSize(.xSmall)
|
||||
}).fullScreenCover(isPresented: $showQRCode) {
|
||||
QRCodeView(damus_state: damus_state, pubkey: damus_state.pubkey)
|
||||
.environmentObject(navigationCoordinator)
|
||||
}
|
||||
}
|
||||
.padding(.top, verticalSpacing)
|
||||
|
||||
Reference in New Issue
Block a user