From fba8813a4d5d1f3c3dcafb591d404e4f27b2157e Mon Sep 17 00:00:00 2001 From: Victor Falcetta do Nascimento Date: Fri, 7 Aug 2020 15:44:29 -0300 Subject: [PATCH] Make it able to vote in more than one idea Motivation: The user, both in the iOS and tvOS, could only vote in one idea. This could make the usage of the app not optimal and sometimes frustrating. Modification: Removed both in the GridViewVotable and VotingView in iOS the map function that toggled off the selected idea that would be voted on when another idea is selected. Results: Users can now vote in more than one idea. --- Blink/Blink/Grid/GridViewVotable.swift | 7 ------- Blink/Blink_iOS/Voting/Views/VotingView.swift | 7 ------- 2 files changed, 14 deletions(-) diff --git a/Blink/Blink/Grid/GridViewVotable.swift b/Blink/Blink/Grid/GridViewVotable.swift index a8a3a93..ab9748d 100644 --- a/Blink/Blink/Grid/GridViewVotable.swift +++ b/Blink/Blink/Grid/GridViewVotable.swift @@ -43,13 +43,6 @@ struct GridViewVotable: View { self.items[row][col].isSelected.toggle() self.currentlyChosen = Idea(content: "") } else { - self.items = self.items.map { $0.map { - var idea = $0 - if $0 == self.currentlyChosen { - idea.isSelected.toggle() - } - return idea - } } self.items[row][col].isSelected.toggle() self.currentlyChosen = self.items[row][col] } diff --git a/Blink/Blink_iOS/Voting/Views/VotingView.swift b/Blink/Blink_iOS/Voting/Views/VotingView.swift index 62e9bbf..bb37ba4 100644 --- a/Blink/Blink_iOS/Voting/Views/VotingView.swift +++ b/Blink/Blink_iOS/Voting/Views/VotingView.swift @@ -48,13 +48,6 @@ struct VotingView: View { } else { Button(action: { self.viewmodel.ideas[index].isSelected.toggle() - self.viewmodel.ideas = self.viewmodel.ideas.map { - var idea = $0 - if $0 == self.currentlyChosen { - idea.isSelected.toggle() - } - return idea - } self.currentlyChosen = self.viewmodel.ideas[index] }, label: { Image(systemName: "circle")