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:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user