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:
parent
9d181fea90
commit
52b2407f49
@ -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") }
|
var tags: [[String]] = liked.tags.filter { tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p") }
|
||||||
tags.append(["e", liked.id])
|
tags.append(["e", liked.id])
|
||||||
tags.append(["p", liked.pubkey])
|
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.calculate_id()
|
||||||
ev.sign(privkey: privkey)
|
ev.sign(privkey: privkey)
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ struct EventActionBar: View {
|
|||||||
HStack(alignment: .bottom) {
|
HStack(alignment: .bottom) {
|
||||||
Text("\(bar.likes > 0 ? "\(bar.likes)" : "")")
|
Text("\(bar.likes > 0 ? "\(bar.likes)" : "")")
|
||||||
.font(.footnote.weight(.medium))
|
.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 {
|
if bar.liked {
|
||||||
notify(.delete, bar.our_like)
|
notify(.delete, bar.our_like)
|
||||||
} else {
|
} else {
|
||||||
@ -145,6 +145,23 @@ func EventActionButton(img: String, col: Color?, action: @escaping () -> ()) ->
|
|||||||
.padding(.trailing, 40)
|
.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 {
|
struct EventActionBar_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
|
Loading…
Reference in New Issue
Block a user