contacts: unify following logic
We are about to add hashtag following, so let's prepare handle_follow
for this. Generalize pubkey following to ReferenceId follows in the
handle_{follow,unfollow} functions.
We also split out the notification part into its own function.
This commit is contained in:
@@ -32,16 +32,16 @@ struct FollowButtonView: View {
|
||||
}
|
||||
}
|
||||
.onReceive(handle_notify(.followed)) { notif in
|
||||
let pk = notif.object as! String
|
||||
if pk != target.pubkey {
|
||||
let pk = notif.object as! ReferencedId
|
||||
if pk.key == "p", pk.ref_id != target.pubkey {
|
||||
return
|
||||
}
|
||||
|
||||
self.follow_state = .follows
|
||||
}
|
||||
.onReceive(handle_notify(.unfollowed)) { notif in
|
||||
let pk = notif.object as! String
|
||||
if pk != target.pubkey {
|
||||
let pk = notif.object as! ReferencedId
|
||||
if pk.key == "p", pk.ref_id != target.pubkey {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user