mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Can set to follow a friend
This commit is contained in:
@ -111,6 +111,7 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
|
||||
? AcceptedFriendTile(
|
||||
friend: _friendsList[i],
|
||||
user: _usersInfo.getUser(_friendsList[i].id),
|
||||
onSetFollowing: _setFollowingFriend,
|
||||
onRequestDelete: _deleteFriend,
|
||||
)
|
||||
: PendingFriendTile(
|
||||
@ -134,6 +135,18 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
|
||||
_loadList();
|
||||
}
|
||||
|
||||
|
||||
/// Update following status of a friend
|
||||
Future<void> _setFollowingFriend(Friend friend, bool follow) async {
|
||||
loading = true;
|
||||
|
||||
if(!await _friendsHelper.setFollowing(friend.id, follow))
|
||||
showSimpleSnack(context, tr("Could not update following status!"));
|
||||
|
||||
_loadList();
|
||||
|
||||
}
|
||||
|
||||
/// Handles deletion request of a friend
|
||||
Future<void> _deleteFriend(Friend f) async {
|
||||
final choice = await showDialog<bool>(
|
||||
|
Reference in New Issue
Block a user