Skip to content

Commit

Permalink
ui: swipe floor to quote
Browse files Browse the repository at this point in the history
  • Loading branch information
BugenZhao committed Oct 29, 2021
1 parent 3aeda6e commit 7f0bd92
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/Shared/Views/PostRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ struct PostRowView: View {
}

var body: some View {
VStack(alignment: .leading, spacing: 10) {
let body = VStack(alignment: .leading, spacing: 10) {
header
content
footer
Expand All @@ -184,8 +184,21 @@ struct PostRowView: View {
#endif
.onAppear { self.post.attachments.map(\.url).forEach(attachments.add(_:)) }
.environmentObject(attachments)

if #available(iOS 15.0, *), let model = postReply {
body
.swipeActions(edge: .leading) { Button(action: { self.doQuote(model: model) }) { Image(systemName: "quote.bubble") } .tint(.accentColor) }
} else {
body
}
}

func onLongPress() {
if let model = postReply {
HapticUtils.play(style: .medium)
doQuote(model: model)
}
}

func doVote(_ operation: PostVoteRequest.Operation) {
logicCallAsync(.postVote(.with {
Expand Down

0 comments on commit 7f0bd92

Please sign in to comment.