1
0
mirror of git://jb55.com/damus synced 2024-10-07 04:03:23 +00:00

Switch like from ❤️ to 🤙

Actually react with 🤙 at the protocol level as well

Changelog-Changed: Switch like from ❤️  to 🤙
This commit is contained in:
William Casarin 2022-12-31 17:44:56 -08:00
parent 9d181fea90
commit 52b2407f49
2 changed files with 20 additions and 3 deletions

View File

@ -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)

View File

@ -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 {