[LLC -> Channel] Segregate sendMessage api call and state handling

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-02-17 20:13:20 +05:30
parent 1a6a06a25f
commit 517c7e489d
2 changed files with 13 additions and 12 deletions
+3 -12
View File
@@ -338,18 +338,9 @@ class Channel {
message = await attachmentsUploadCompleter.future;
}
final response = await _client.post(
'$_channelURL/message',
data: {
'message': message.toJson(),
},
);
final res = _client.decode(response.data, SendMessageResponse.fromJson);
state?.addMessage(res.message);
return res;
final response = await _client.sendMessage(message, id, type);
state?.addMessage(response.message);
return response;
} catch (error) {
if (error is DioError && error.type != DioErrorType.RESPONSE) {
state?.retryQueue?.add([message]);