1
0
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:
2019-05-01 19:46:13 +02:00
parent 7c3390f8af
commit eba12736e9
3 changed files with 56 additions and 8 deletions

View File

@ -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>(