Giter Site home page Giter Site logo

yannickl / reactions Goto Github PK

View Code? Open in Web Editor NEW
584.0 584.0 89.0 393 KB

Fully customizable Facebook reactions like control

Home Page: http://cocoadocs.org/docsets/Reactions

License: MIT License

Swift 99.19% Ruby 0.81%
facebook reactions swift

reactions's People

Contributors

yannickl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactions's Issues

Reactions pop-up view not showing in UITableviewcell

I'm trying to implement this into UITableviewCell so, it can work like Facebook. But unfortunately unable to get popup in cell. Whereas if I'm implementing it in UIViewController simply than it works fine.
Can anyone help-me out with this?

disable long press facebookReactionButton

Great job, is there a way to disable the long press animation of the facebookReactionButton, I only want to enable the like and dislike, no the ReactionSummary when I pressed for a long time.

Image Edge Insets?

Is there a way to set the image edge insets for the reaction button? I'm trying to set an image for the reaction button with a 100 by 25 point frame. But, the image is not filling the button's entire frame, even though it has the same pixels when exported in Sketch as a PNG file.

Change Reaction Icons?

Is there a way to change the reaction icons? In other words, how do I change "Like", "Love", "Haha", "Wow", or "Angry"?

Button + Selector

How do I know when the reaction changed on a button? Even if that's triggered from a selector?

How to set default Reaction Button ?

My code:

private let button = ReactionButton()
button.reaction = Reaction.facebook.sad

But by default, it is still like.
And there's one more problem. I want to set the time when ReactionSelector displays to 500ms, what should I do?

Help me, Please

Overlay views are not getting removed from window

For each and every ReactionButton there will be an "overlay" view and that overlay view is attached to UIApplication window whenever user started to react.

But there is no where you are removing the "overlay" view from window, so because of this if user reacting on 100 cells will lead to create 100 overlay views and it wont get removed from superview even after user came out from that controller.

Steps To Reproduce:

1)Run the example Project
2)Press "View inside Tableview cells"
3)Do reactions in cells
4)Come out from the screen
5)Run the view inspector from your xcode,

You will get similar to this,

Screenshot 2020-02-27 at 4 59 58 PM

I reacted four times, so four overlays + reaction selector got created.

Solution:
We can remove the "overlay" view whenever ReactionButton removed from it's superview

I am not able to set custom icon.

Below is the code to set my custom icon. But still, it is showing library provided icon icon.

var reactionButton: ReactionButton!{
        didSet {
            reactionButton.reactionSelector = ReactionSelector()
            reactionButton.reactionSelector?.setReactions(self.createReactions())    
       }

func createReactions() -> [Reaction] {
        var reactionArray = [Reaction]()
        let like = Reaction(id: "1", title: "Like", color: .red, icon: UIImage(named: "myIcon.png")!)
       reactionArray = [like]
       return reactionArray
}

does not work after i call view from tabbar

when i go to the rection view from tabbar it give me error (Fatal error: Unexpectedly found nil while unwrapping an Optional value)
and some warnings like ([framework] CUICatalog: Invalid asset name supplied:

[1771:665213] Could not load the "" image referenced from a nib in the bundle with identifier " ")

Reactions receives no input whatsoever.

I've added Reactions to a UIView and the animations do not change when I mouse hover or click, leading me to believe that it's receiving no input whatsoever. What could cause this?

var select = ReactionSelector()
select.reactions = Reaction.facebook.all
containerView.addSubview(select)

how i should integrate with objective c

I have tried so many types to assign the reaction values in objective c , bridging the file and so on, can you please tell how to integrate into objective c finally we triggered only define the class for that uiview and getting outlet of that uiview (ReactionSummary, ReactionSelector, ReactionButton)
and we can not able to delegate the method of "ReactionFeedbackDelegate" ,,,

Please tell if you done this...!! and explain it..

Thank you! !!!!!

feedback for feedback delegate

Could you explain how or what you can do with the feedback delegate because currently, it's just sitting in the swift file empty and the description doesn't really explain anything?

New Feature

Hey I was wondering if you would be able to add in a feature to this framework.

Introduce spectral emotions.

Fixing the `ReactionSummary` aggregate icons

For the moment the ReactionSummary icons are drawn with a white border. The white border is drawn inside the image so it crops it and thats not elegant. We should first draw a white circle and then the icon inside without border.

Conflicting UILongPressGestureRecognizer with Reactions Button.

I have a Reactions Button that's added to a view controller's view. But, when the view has a UILongPressGestureRecognizer, also in the view, it seems to override the Reactions' selector methods where it shows the reactions. Is there a work around for this?

I got some issue when I update your framework.

I found that below is code in your old version, and in the new version it is changed.

import UIKit

/// Default implementation of the facebook reactions.
extension Reaction {
  /// Struct which defines the standard facebook reactions.
  public struct facebook {

  public static var count:Int = 0
    /// The facebook's "like" reaction.
    
   
    public static var like: Reaction {
        return reactionWithId("1",name: "like",count:count)
    }

    /// The facebook's "love" reaction.
    public static var handpressed: Reaction {
      return reactionWithId("8",name: "handpressed",count:count)
    }

    /// The facebook's "haha" reaction.
    public static var openhand: Reaction {
      return reactionWithId("3",name: "openhand",count:count)
    }

    /// The facebook's "wow" reaction.
    public static var okhand: Reaction {
      return reactionWithId("4",name: "okhand",count:count)
    }

    /// The facebook's "sad" reaction.
    public static var smilingface: Reaction {
        return reactionWithId("2",name: "smiling-face",count:count)
    }

    /// The facebook's "sad" reaction.
    public static var surprised: Reaction {
        return reactionWithId("6",name: "surprised",count:count)
    }

    /// The facebook's "sad" reaction.
    public static var grinningface: Reaction {
        return reactionWithId("5",name: "grinning-face",count:count)
    }

    /// The facebook's "sad" reaction.
    public static var crying: Reaction {
      return reactionWithId("9",name: "crying",count:count)
    }

    /// The facebook's "angry" reaction.
    public static var pouting: Reaction {
      return reactionWithId("7",name: "pouting",count:count)
    }

    /// The facebook's "angry" reaction.
    public static var usaflag: Reaction {
        return reactionWithId("10",name: "usa-flag",count:count)
    }

    /// The list of standard facebook reactions in this order: `.like`, `.love`, `.haha`, `.wow`, `.sad`, `.angry`.
//    public static let all: [Reaction] = [facebook.like, facebook.love, facebook.haha, facebook.wow,facebook.smilingface,facebook.surprised,facebook.angry,facebook.grinningface,facebook.sad,facebook.usaflag]

    public static let all: [Reaction] = [facebook.like,facebook.smilingface,facebook.openhand,facebook.okhand,facebook.grinningface,facebook.surprised,facebook.pouting,facebook.handpressed,facebook.crying,facebook.usaflag]
    
    
    // MARK: - Convenience Methods

    private static func reactionWithId(_ id: String,name:String) -> Reaction {
      var color: UIColor            = .black
      var alternativeIcon: UIImage? = nil

      switch name {
      case "like":
        color = UIColor(red: 1/255.0, green:158/255.0, blue: 92/255.0, alpha: 1)
        alternativeIcon = imageWithName("like-template").withRenderingMode(.alwaysTemplate)
      case "love":
        color = UIColor(red: 0.93, green: 0.23, blue: 0.33, alpha: 1)
      case "angry":
        color = UIColor(red: 0.96, green: 0.37, blue: 0.34, alpha: 1)
      default:
        color = UIColor(red: 0.99, green: 0.84, blue: 0.38, alpha: 1)
      }

      return Reaction(id: id, title: name.localized(from: "FacebookReactionLocalizable"), color: color, icon: imageWithName(name), alternativeIcon: alternativeIcon)
    }
    private static func reactionWithId(_ id: String,name:String,count:Int) -> Reaction {
        var color: UIColor            = .black
        var alternativeIcon: UIImage? = nil

        switch name {
        case "like":
            color = UIColor(red: 1/255.0, green:158/255.0, blue: 92/255.0, alpha: 1)
            alternativeIcon = imageWithName("like-template").withRenderingMode(.alwaysTemplate)
        case "love":
            color = UIColor(red: 0.93, green: 0.23, blue: 0.33, alpha: 1)
        case "angry":
            color = UIColor(red: 0.96, green: 0.37, blue: 0.34, alpha: 1)
        default:
            color = UIColor(red: 0.99, green: 0.84, blue: 0.38, alpha: 1)
        }

        return Reaction(id: id, title: name.localized(from: "FacebookReactionLocalizable"), color: color, icon: imageWithName(name), alternativeIcon: alternativeIcon,count:count)
    }

    private static func imageWithName(_ name: String) -> UIImage {
      return UIImage(named: name, in: .reactionsBundle(), compatibleWith: nil)!
    }
  }
}

But when I move to your old tag file version like 1.0.0 and 2.0.0. All have the same code in this file. It looks like you haven't maintained all the version. That's why you have same code in all the version.
Correct me if I'm wrong.

How to set unselected reaction?

How to set unselected reaction once iboutlet did set?

i am using pod 'Reactions', '~> 1.1.1'

My first item selected reaction is a grey color. Just like its working on facebook reaction

@IBOutlet weak var reactionnButton: ReactionButton! {
        didSet {

            let select = ReactionSelector()
            let reactionLike =      Reaction(id: "id", title: "Like", color: .red, icon: #imageLiteral(resourceName: "like"))
            let reactionAngry =     Reaction(id: "id", title: "Angry", color: .red, icon: #imageLiteral(resourceName: "emoji_angry"))
            let reactionEnvy =      Reaction(id: "id", title: "Envy", color: .red, icon: #imageLiteral(resourceName: "emoji_envy"))
            let reactionLove =      Reaction(id: "id", title: "Love", color: .red, icon: #imageLiteral(resourceName: "emoji_love"))
            let reactionSick =      Reaction(id: "id", title: "Sick", color: .red, icon: #imageLiteral(resourceName: "emoji_sick"))
            let reactionHappy =     Reaction(id: "id", title: "Happy", color: .red, icon: #imageLiteral(resourceName: "emoji_happy"))
            let reactionCrying =    Reaction(id: "id", title: "Crying", color: .red, icon: #imageLiteral(resourceName: "emoji_crying"))
            
            select.reactions = [
                reactionLike,
                reactionAngry,
                reactionEnvy,
                reactionLove,
                reactionSick,
                reactionHappy,
                reactionCrying
            ]
            
            //select.reactions = Reaction.facebook.all
            
            //select.selectedReaction = Reaction(id: "id", title: "Angry", color: .red, icon: #imageLiteral(resourceName: "like-template"))
            
            reactionnButton.reactionSelector = select
            reactionnButton.config           = ReactionButtonConfig() {
                $0.iconMarging      = 15
                $0.spacing          = 5
                $0.font             = UIFont(name: "ApexRounded-Book", size: 14)
                $0.neutralTintColor = UIColor(red: 0.47, green: 0.47, blue: 0.47, alpha: 1)
                $0.alignment        = .centerLeft
            }
            
            
            
            reactionnButton.reactionSelector?.feedbackDelegate = self
            
            // This one takes a value from ReactionSelector
            reactionnButton.addTarget(self, action: #selector(reactionChanged), for: .valueChanged)
            // And this one from ReactionButton
            reactionnButton.addTarget(self, action: #selector(reactionChanged), for: .touchUpInside)
        }
    }

Application become unresponsive

We have 'ReactionSelector' in a TableView cell. If the first-cell like button is nearby to the navigation bar (we are using one view as navigation bar), 'ReactionSelector' appears above the bar and dismiss won't work. So, the full app becomes unresponsive including the tableview. Please let me know is there anything we can do for this issue ? Can we show ReactionSelector on bottom ?

Button does not work inside StackView

I placed a ReactionButton (programmatically and storyboard), and it has errors when placing button under a stackView;
Screen Shot 2020-11-02 at 1 04 54 AM
Only the "Like" icon above is displayed, and the text is missing. it is also unresponsive to click events. Please help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.