Reactions: Plug button actions

This commit is contained in:
manuroe
2019-05-16 07:37:45 +02:00
parent e4e7261360
commit 948ced2568
7 changed files with 132 additions and 22 deletions
@@ -29,8 +29,6 @@ final class ReactionsMenuView: UIView, NibOwnerLoadable {
// MARK: Private
//private var strengthViews: [UIView] = []
// MARK: Public
var viewModel: ReactionsMenuViewModelType? {
@@ -54,18 +52,36 @@ final class ReactionsMenuView: UIView, NibOwnerLoadable {
self.commonInit()
}
// MARK: - Actions
@IBAction private func agreeButtonAction(_ sender: Any) {
self.viewModel?.process(viewAction: .toggleReaction(.agree))
}
@IBAction private func disagreeButtonAction(_ sender: Any) {
self.viewModel?.process(viewAction: .toggleReaction(.disagree))
}
@IBAction private func likeButtonAction(_ sender: Any) {
self.viewModel?.process(viewAction: .toggleReaction(.like))
}
@IBAction private func dislikeButtonAction(_ sender: Any) {
self.viewModel?.process(viewAction: .toggleReaction(.dislike))
}
// MARK: - Private
private func commonInit() {
agreeButton.setTitle(VectorL10n.roomEventActionReactionAgree(ReactionsMenuReactions.agree.rawValue), for: .normal)
agreeButton.setTitle(VectorL10n.roomEventActionReactionAgree(ReactionsMenuReactions.agree.rawValue), for: .highlighted)
disagreeButton.setTitle(VectorL10n.roomEventActionReactionDisagree(ReactionsMenuReactions.disagree.rawValue), for: .normal)
disagreeButton.setTitle(VectorL10n.roomEventActionReactionDisagree(ReactionsMenuReactions.disagree.rawValue), for: .highlighted)
likeButton.setTitle(VectorL10n.roomEventActionReactionLike(ReactionsMenuReactions.like.rawValue), for: .normal)
likeButton.setTitle(VectorL10n.roomEventActionReactionLike(ReactionsMenuReactions.like.rawValue), for: .highlighted)
dislikeButton.setTitle(VectorL10n.roomEventActionReactionDislike(ReactionsMenuReactions.dislike.rawValue), for: .normal)
dislikeButton.setTitle(VectorL10n.roomEventActionReactionDislike(ReactionsMenuReactions.dislike.rawValue), for: .highlighted)
agreeButton.setTitle(VectorL10n.roomEventActionReactionAgree(ReactionsMenuReaction.agree.rawValue), for: .normal)
agreeButton.setTitle(VectorL10n.roomEventActionReactionAgree(ReactionsMenuReaction.agree.rawValue), for: .highlighted)
disagreeButton.setTitle(VectorL10n.roomEventActionReactionDisagree(ReactionsMenuReaction.disagree.rawValue), for: .normal)
disagreeButton.setTitle(VectorL10n.roomEventActionReactionDisagree(ReactionsMenuReaction.disagree.rawValue), for: .highlighted)
likeButton.setTitle(VectorL10n.roomEventActionReactionLike(ReactionsMenuReaction.like.rawValue), for: .normal)
likeButton.setTitle(VectorL10n.roomEventActionReactionLike(ReactionsMenuReaction.like.rawValue), for: .highlighted)
dislikeButton.setTitle(VectorL10n.roomEventActionReactionDislike(ReactionsMenuReaction.dislike.rawValue), for: .normal)
dislikeButton.setTitle(VectorL10n.roomEventActionReactionDislike(ReactionsMenuReaction.dislike.rawValue), for: .highlighted)
customizeViewRendering()
}