From 7f0bd920792c1639f578569c8579e20accd3cdac Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Fri, 29 Oct 2021 23:23:55 +0800 Subject: [PATCH] ui: swipe floor to quote --- app/Shared/Views/PostRowView.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Shared/Views/PostRowView.swift b/app/Shared/Views/PostRowView.swift index 3d97e129..21ab7e29 100644 --- a/app/Shared/Views/PostRowView.swift +++ b/app/Shared/Views/PostRowView.swift @@ -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 @@ -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 {