damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 52b2407f49bd09b064f989641e577e269f2ee323
parent 9d181fea90b28ad0111f5e5c23d19bbdbcaa943c
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 31 Dec 2022 17:44:56 -0800

Switch like from ❤️  to 🤙

Actually react with 🤙 at the protocol level as well

Changelog-Changed: Switch like from ❤️  to 🤙

Diffstat:
Mdamus/Nostr/NostrEvent.swift | 2+-
Mdamus/Views/EventActionBar.swift | 21+++++++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/damus/Nostr/NostrEvent.swift b/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) diff --git a/damus/Views/EventActionBar.swift b/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 {