yannickl / Reactions

Fully customizable Facebook reactions like control
http://cocoadocs.org/docsets/Reactions
MIT License
584 stars 90 forks source link

I got some issue when I update your framework. #28

Closed Rjmaurya13 closed 5 years ago

Rjmaurya13 commented 5 years ago

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.

yannickl commented 5 years ago

I don't understand your issue, so sorry if my answer is off topic.

The code you shared is not part of the library, this is a modified version by you.

The FacebookReactions.swift has not been modified between the version yes.

Rjmaurya13 commented 5 years ago

Ok @yannickl But when I installed your library still I get this icon. I am using Reaction -> 1.1.1 version. That versions has above file.

yannickl commented 5 years ago

You can check the file is the v1.1.1, there is no grinningface for instance.

How are you installing the library?