Compare commits

...
Author SHA1 Message Date
tyiu 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
+55 -47
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)
}
}
.ignoresSafeArea()
.navigationTitle("")
.navigationBarHidden(true)
.overlay(customNavbar, alignment: .top)
.onReceive(handle_notify(.switched_timeline)) { _ in
dismiss()
}
.onAppear() {
profile.subscribe()
//followers.subscribe()
}
.onDisappear {
profile.unsubscribe()
followers.unsubscribe()
// our profilemodel needs a bit more help
}
.sheet(isPresented: $show_share_sheet) {
if let npub = bech32_pubkey(profile.pubkey) {
if let url = URL(string: "https://damus.io/" + npub) {
ShareSheet(activityItems: [url])
} }
} }
.padding(.horizontal, Theme.safeAreaInsets?.left) }
.zIndex(-yOffset > navbarHeight ? 0 : 1) .fullScreenCover(isPresented: $show_qr_code) {
QRCodeView(damus_state: damus_state, pubkey: profile.pubkey)
} }
}
.ignoresSafeArea() if profile.pubkey == damus_state.pubkey && damus_state.is_privkey_user {
.navigationTitle("") PostButtonContainer(is_left_handed: damus_state.settings.left_handed) {
.navigationBarHidden(true) notify(.compose, PostAction.posting)
.overlay(customNavbar, alignment: .top)
.onReceive(handle_notify(.switched_timeline)) { _ in
dismiss()
}
.onAppear() {
profile.subscribe()
//followers.subscribe()
}
.onDisappear {
profile.unsubscribe()
followers.unsubscribe()
// our profilemodel needs a bit more help
}
.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)
} }
} }
} }