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