Profile: Add Universal Link share button
Changelog-Added: Added share button to profile
This commit is contained in:
@@ -113,6 +113,7 @@ struct ProfileView: View {
|
|||||||
@State private var showingEditProfile = false
|
@State private var showingEditProfile = false
|
||||||
@State var showing_select_wallet: Bool = false
|
@State var showing_select_wallet: Bool = false
|
||||||
@State var is_zoomed: Bool = false
|
@State var is_zoomed: Bool = false
|
||||||
|
@State var show_share_sheet: Bool = false
|
||||||
@StateObject var user_settings = UserSettingsStore()
|
@StateObject var user_settings = UserSettingsStore()
|
||||||
|
|
||||||
@Environment(\.dismiss) var dismiss
|
@Environment(\.dismiss) var dismiss
|
||||||
@@ -166,6 +167,18 @@ struct ProfileView: View {
|
|||||||
|
|
||||||
static let markdown = Markdown()
|
static let markdown = Markdown()
|
||||||
|
|
||||||
|
var ShareButton: some View {
|
||||||
|
Button(action: {
|
||||||
|
show_share_sheet = true
|
||||||
|
}) {
|
||||||
|
Image(systemName: "square.and.arrow.up.circle.fill")
|
||||||
|
.symbolRenderingMode(.palette)
|
||||||
|
.font(.system(size: 32))
|
||||||
|
.padding()
|
||||||
|
.foregroundStyle(.white, .black, .black.opacity(0.8))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var DMButton: some View {
|
var DMButton: some View {
|
||||||
let dm_model = damus_state.dms.lookup_or_create(profile.pubkey)
|
let dm_model = damus_state.dms.lookup_or_create(profile.pubkey)
|
||||||
let dmview = DMChatView(damus_state: damus_state, pubkey: profile.pubkey)
|
let dmview = DMChatView(damus_state: damus_state, pubkey: profile.pubkey)
|
||||||
@@ -186,6 +199,9 @@ struct ProfileView: View {
|
|||||||
.aspectRatio(contentMode: .fill)
|
.aspectRatio(contentMode: .fill)
|
||||||
.frame(width: geo.size.width, height: 150)
|
.frame(width: geo.size.width, height: 150)
|
||||||
.clipped()
|
.clipped()
|
||||||
|
|
||||||
|
ShareButton
|
||||||
|
.offset(x: geo.size.width - 80.0, y: 50.0 )
|
||||||
}
|
}
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
let data = damus_state.profiles.lookup(id: profile.pubkey)
|
let data = damus_state.profiles.lookup(id: profile.pubkey)
|
||||||
@@ -223,8 +239,10 @@ struct ProfileView: View {
|
|||||||
EditButton(damus_state: damus_state)
|
EditButton(damus_state: damus_state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.offset(y: -15.0) // Increase if set a frame
|
.offset(y: -15.0) // Increase if set a frame
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileNameView(pubkey: profile.pubkey, profile: data, damus: damus_state)
|
ProfileNameView(pubkey: profile.pubkey, profile: data, damus: damus_state)
|
||||||
@@ -324,6 +342,13 @@ struct ProfileView: View {
|
|||||||
followers.unsubscribe()
|
followers.unsubscribe()
|
||||||
// our profilemodel needs a bit more help
|
// 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])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.ignoresSafeArea()
|
.ignoresSafeArea()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user