Browse Source

Switch like from ❤️ to 🤙

Actually react with 🤙 at the protocol level as well

Changelog-Changed: Switch like from ❤️  to 🤙
post-button-style
William Casarin 2 years ago
parent
commit
52b2407f49
  1. 2
      damus/Nostr/NostrEvent.swift
  2. 21
      damus/Views/EventActionBar.swift

2
damus/Nostr/NostrEvent.swift

@ -558,7 +558,7 @@ func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> Nost
var tags: [[String]] = liked.tags.filter { tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p") }
tags.append(["e", liked.id])
tags.append(["p", liked.pubkey])
let ev = NostrEvent(content: "", pubkey: pubkey, kind: 7, tags: tags)
let ev = NostrEvent(content: "🤙", pubkey: pubkey, kind: 7, tags: tags)
ev.calculate_id()
ev.sign(privkey: privkey)

21
damus/Views/EventActionBar.swift

@ -59,9 +59,9 @@ struct EventActionBar: View {
HStack(alignment: .bottom) {
Text("\(bar.likes > 0 ? "\(bar.likes)" : "")")
.font(.footnote.weight(.medium))
.foregroundColor(bar.liked ? Color.red : Color.gray)
.foregroundColor(bar.liked ? Color.orange : Color.gray)
EventActionButton(img: bar.liked ? "heart.fill" : "heart", col: bar.liked ? Color.red : nil) {
LikeButton(liked: bar.liked) {
if bar.liked {
notify(.delete, bar.our_like)
} else {
@ -145,6 +145,23 @@ func EventActionButton(img: String, col: Color?, action: @escaping () -> ()) ->
.padding(.trailing, 40)
}
struct LikeButton: View {
let liked: Bool
let action: () -> ()
@Environment(\.colorScheme) var colorScheme
var default_emoji: String {
return colorScheme == .dark ? "🤙🏿" : "🤙🏻"
}
var body: some View {
Button(action: action) {
Text(liked ? "🤙" : default_emoji)
}
}
}
struct EventActionBar_Previews: PreviewProvider {
static var previews: some View {

Loading…
Cancel
Save