mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Open private conversation from friends list
This commit is contained in:
@ -58,8 +58,7 @@ class ConversationsHelper {
|
||||
|
||||
final response = await request.exec();
|
||||
|
||||
if(response.code != 200)
|
||||
return false;
|
||||
if (response.code != 200) return false;
|
||||
|
||||
//Delete old conversation entry from the database
|
||||
await _conversationsDatabaseHelper.delete(settings.id);
|
||||
@ -160,6 +159,30 @@ class ConversationsHelper {
|
||||
return name;
|
||||
}
|
||||
|
||||
/// Search and return a private conversation with a given [userID]. If such
|
||||
/// conversation does not exists, it is created if [allowCreate] is set to
|
||||
/// true
|
||||
Future<int> getPrivate(int userID, {bool allowCreate = true}) async {
|
||||
final response = await APIRequest(
|
||||
uri: "conversations/getPrivate",
|
||||
needLogin: true,
|
||||
args: {
|
||||
"otherUser": userID.toString(),
|
||||
"allowCreate": allowCreate.toString()
|
||||
},
|
||||
).exec();
|
||||
|
||||
if (response.code != 200) return null;
|
||||
|
||||
// Get and return conversation ID
|
||||
try {
|
||||
return int.parse(response.getObject()["conversationsID"][0]);
|
||||
} catch (e) {
|
||||
e.toString();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// Asynchronously get the name fo the conversation
|
||||
///
|
||||
/// Unlike the synchronous method, this method does not need information
|
||||
|
Reference in New Issue
Block a user