1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 00:05:16 +00:00

Can respond to friendship requests

This commit is contained in:
2019-05-01 18:01:20 +02:00
parent 5021ded039
commit a7b2bf410e
2 changed files with 51 additions and 23 deletions

View File

@ -24,15 +24,31 @@ class FriendsHelper {
// Parse and return the list of friends
FriendsList list = FriendsList();
response.getArray().forEach((f) =>
list.add(Friend(
id: f["ID_friend"],
accepted: f["accepted"] == 1,
lastActive: f["time_last_activity"],
following: f["following"] == 1,
canPostTexts: f["canPostTexts"],),),
);
response.getArray().forEach(
(f) => list.add(
Friend(
id: f["ID_friend"],
accepted: f["accepted"] == 1,
lastActive: f["time_last_activity"],
following: f["following"] == 1,
canPostTexts: f["canPostTexts"],
),
),
);
return list;
}
}
/// Respond to friendship request
Future<bool> respondRequest(int friendID, bool accept) async {
final response = await APIRequest(
uri: "friends/respondRequest",
needLogin: true,
args: {
"friendID": friendID.toString(),
"accept": accept.toString()
}).exec();
return response.code == 200;
}
}