Merge branch 'damus-io:master' into sidebar

This commit is contained in:
Ben Weeks
2023-01-06 23:06:44 +00:00
committed by GitHub
11 changed files with 175 additions and 50 deletions

View File

@@ -24,6 +24,7 @@ struct EventActionBar: View {
let generator = UIImpactFeedbackGenerator(style: .medium)
@State var sheet: ActionBarSheet? = nil
@State var confirm_boost: Bool = false
@State var show_share_sheet: Bool = false
@StateObject var bar: ActionBarModel
var body: some View {
@@ -40,6 +41,7 @@ struct EventActionBar: View {
EventActionButton(img: "bubble.left", col: nil) {
notify(.reply, event)
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
}
HStack(alignment: .bottom) {
@@ -55,6 +57,7 @@ struct EventActionBar: View {
}
}
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
HStack(alignment: .bottom) {
Text("\(bar.likes > 0 ? "\(bar.likes)" : "")")
@@ -69,6 +72,12 @@ struct EventActionBar: View {
}
}
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
EventActionButton(img: "square.and.arrow.up", col: Color.gray) {
show_share_sheet = true
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
/*
HStack(alignment: .bottom) {
@@ -86,6 +95,13 @@ struct EventActionBar: View {
}
*/
}
.sheet(isPresented: $show_share_sheet) {
if let note_id = bech32_note_id(event.id) {
if let url = URL(string: "https://damus.io/" + note_id) {
ShareSheet(activityItems: [url])
}
}
}
.alert("Boost", isPresented: $confirm_boost) {
Button("Cancel") {
confirm_boost = false
@@ -142,7 +158,6 @@ func EventActionButton(img: String, col: Color?, action: @escaping () -> ()) ->
.font(.footnote.weight(.medium))
.foregroundColor(col == nil ? Color.gray : col!)
}
.padding(.trailing, 40)
}
struct LikeButton: View {

View File

@@ -51,7 +51,9 @@ struct InnerProfilePicView: View {
}
var body: some View {
Group {
ZStack {
Color(uiColor: .systemBackground)
KFAnimatedImage(url)
.callbackQueue(.dispatch(.global(qos: .background)))
.processingQueue(.dispatch(.global(qos: .background)))

View File

@@ -113,6 +113,7 @@ struct ProfileView: View {
@State private var showingEditProfile = false
@State var showing_select_wallet: Bool = false
@State var is_zoomed: Bool = false
@State var show_share_sheet: Bool = false
@StateObject var user_settings = UserSettingsStore()
@Environment(\.dismiss) var dismiss
@@ -165,7 +166,19 @@ struct ProfileView: View {
}
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 {
let dm_model = damus_state.dms.lookup_or_create(profile.pubkey)
let dmview = DMChatView(damus_state: damus_state, pubkey: profile.pubkey)
@@ -186,6 +199,9 @@ struct ProfileView: View {
.aspectRatio(contentMode: .fill)
.frame(width: geo.size.width, height: 150)
.clipped()
ShareButton
.offset(x: geo.size.width - 80.0, y: 50.0 )
}
VStack(alignment: .leading) {
let data = damus_state.profiles.lookup(id: profile.pubkey)
@@ -200,7 +216,7 @@ struct ProfileView: View {
ProfilePicView(pubkey: profile.pubkey, size: zoom_size, highlight: .none, profiles: damus_state.profiles)
}
.offset(y: -(pfp_size/2.0)) // Increase if set a frame
Spacer()
Group {
@@ -223,10 +239,12 @@ struct ProfileView: View {
EditButton(damus_state: damus_state)
}
}
}
.offset(y: -15.0) // Increase if set a frame
}
ProfileNameView(pubkey: profile.pubkey, profile: data, damus: damus_state)
//.padding(.bottom)
.padding(.top,-(pfp_size/2.0))
@@ -324,6 +342,13 @@ struct ProfileView: View {
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])
}
}
}
.ignoresSafeArea()
}
}
@@ -380,15 +405,11 @@ struct KeyView: View {
isCopied = false
}
} label: {
Label {
Text("Public key")
} icon: {
Image("ic-key")
.contentShape(Rectangle())
.frame(width: 16, height: 16)
}
.labelStyle(IconOnlyLabelStyle())
.symbolRenderingMode(.hierarchical)
Label("Public Key", systemImage: "key.fill")
.font(.custom("key", size: 12.0))
.labelStyle(IconOnlyLabelStyle())
.foregroundStyle(hex_to_rgb(pubkey))
.symbolRenderingMode(.palette)
}
.padding(.leading,4)
Text(abbrev_pubkey(bech32, amount: 16))