Skip to content

Commit

Permalink
follow, unfollow
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-lox committed Oct 15, 2024
1 parent 7c59caa commit 580b19a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ class _FollowerPageState extends ConsumerState<FollowerPage> {
/// follow Change - true to add, false to remove
void _changeFollowing(
bool followChange, String pubkey, ContactList currentOwnContacts) async {
final followService = ref.read(followingProvider);
List<String> newContacts = [...currentOwnContacts.contacts];

if (followChange) {
newContacts.add(pubkey);
followService.followUser(pubkey);
} else {
newContacts.removeWhere((element) => element == pubkey);
followService.unfollowUser(pubkey);
}

ref.read(followingProvider).setContacts(newContacts);
}

@override
Expand Down

0 comments on commit 580b19a

Please sign in to comment.