File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -198,11 +198,7 @@ struct PollOptionView: View {
198198 HStack ( alignment: . top, spacing: checkboxButtonSpacing) {
199199 if !viewModel. poll. isClosed {
200200 Button {
201- if viewModel. optionVotedByCurrentUser ( option) {
202- viewModel. removePollVote ( for: option)
203- } else {
204- viewModel. castPollVote ( for: option)
205- }
201+ togglePollVote ( )
206202 } label: {
207203 if viewModel. optionVotedByCurrentUser ( option) {
208204 Image ( systemName: " checkmark.circle.fill " )
@@ -239,6 +235,18 @@ struct PollOptionView: View {
239235 }
240236 }
241237 }
238+ . contentShape ( Rectangle ( ) )
239+ . onTapGesture {
240+ togglePollVote ( )
241+ }
242+ }
243+
244+ func togglePollVote( ) {
245+ if viewModel. optionVotedByCurrentUser ( option) {
246+ viewModel. removePollVote ( for: option)
247+ } else {
248+ viewModel. castPollVote ( for: option)
249+ }
242250 }
243251}
244252
You can’t perform that action at this time.
0 commit comments