Compare commits

...

1 Commits

Author SHA1 Message Date
8678ca7144 Add post button when logged in with private key and on own profile view
Changelog-Added: Add post button when logged in with private key and on own profile view
2023-06-25 20:57:53 -04:00

View File

@@ -466,60 +466,68 @@ struct ProfileView: View {
} }
var body: some View { var body: some View {
ScrollView(.vertical) { ZStack {
VStack(spacing: 0) { ScrollView(.vertical) {
bannerSection VStack(spacing: 0) {
.zIndex(1) bannerSection
.zIndex(1)
VStack() {
aboutSection
VStack(spacing: 0) {
CustomPicker(selection: $filter_state, content: {
Text("Notes", comment: "Label for filter for seeing only your notes (instead of notes and replies).").tag(FilterState.posts)
Text("Notes & Replies", comment: "Label for filter for seeing your notes and replies (instead of only your notes).").tag(FilterState.posts_and_replies)
})
Divider()
.frame(height: 1)
}
.background(colorScheme == .dark ? Color.black : Color.white)
if filter_state == FilterState.posts { VStack() {
InnerTimelineView(events: profile.events, damus: damus_state, filter: FilterState.posts.filter) aboutSection
VStack(spacing: 0) {
CustomPicker(selection: $filter_state, content: {
Text("Notes", comment: "Label for filter for seeing only your notes (instead of notes and replies).").tag(FilterState.posts)
Text("Notes & Replies", comment: "Label for filter for seeing your notes and replies (instead of only your notes).").tag(FilterState.posts_and_replies)
})
Divider()
.frame(height: 1)
}
.background(colorScheme == .dark ? Color.black : Color.white)
if filter_state == FilterState.posts {
InnerTimelineView(events: profile.events, damus: damus_state, filter: FilterState.posts.filter)
}
if filter_state == FilterState.posts_and_replies {
InnerTimelineView(events: profile.events, damus: damus_state, filter: FilterState.posts_and_replies.filter)
}
} }
if filter_state == FilterState.posts_and_replies { .padding(.horizontal, Theme.safeAreaInsets?.left)
InnerTimelineView(events: profile.events, damus: damus_state, filter: FilterState.posts_and_replies.filter) .zIndex(-yOffset > navbarHeight ? 0 : 1)
} }
} }
.padding(.horizontal, Theme.safeAreaInsets?.left) .ignoresSafeArea()
.zIndex(-yOffset > navbarHeight ? 0 : 1) .navigationTitle("")
} .navigationBarHidden(true)
} .overlay(customNavbar, alignment: .top)
.ignoresSafeArea() .onReceive(handle_notify(.switched_timeline)) { _ in
.navigationTitle("") dismiss()
.navigationBarHidden(true) }
.overlay(customNavbar, alignment: .top) .onAppear() {
.onReceive(handle_notify(.switched_timeline)) { _ in profile.subscribe()
dismiss() //followers.subscribe()
} }
.onAppear() { .onDisappear {
profile.subscribe() profile.unsubscribe()
//followers.subscribe() followers.unsubscribe()
} // our profilemodel needs a bit more help
.onDisappear { }
profile.unsubscribe() .sheet(isPresented: $show_share_sheet) {
followers.unsubscribe() if let npub = bech32_pubkey(profile.pubkey) {
// our profilemodel needs a bit more help if let url = URL(string: "https://damus.io/" + npub) {
} ShareSheet(activityItems: [url])
.sheet(isPresented: $show_share_sheet) { }
if let npub = bech32_pubkey(profile.pubkey) { }
if let url = URL(string: "https://damus.io/" + npub) { }
ShareSheet(activityItems: [url]) .fullScreenCover(isPresented: $show_qr_code) {
QRCodeView(damus_state: damus_state, pubkey: profile.pubkey)
}
if profile.pubkey == damus_state.pubkey && damus_state.is_privkey_user {
PostButtonContainer(is_left_handed: damus_state.settings.left_handed) {
notify(.compose, PostAction.posting)
} }
} }
}
.fullScreenCover(isPresented: $show_qr_code) {
QRCodeView(damus_state: damus_state, pubkey: profile.pubkey)
} }
} }
} }