[LLC, UI-KIT] Add support for custom attachment upload delegate
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -223,19 +223,27 @@ class Channel {
|
||||
}
|
||||
|
||||
/// Send a file to this channel
|
||||
Future<SendFileResponse> sendFile(MultipartFile file) async {
|
||||
Future<SendFileResponse> sendFile(
|
||||
MultipartFile file, {
|
||||
ProgressCallback onSendProgress,
|
||||
}) async {
|
||||
final response = await _client.post(
|
||||
'$_channelURL/file',
|
||||
data: FormData.fromMap({'file': file}),
|
||||
onSendProgress: onSendProgress,
|
||||
);
|
||||
return _client.decode(response.data, SendFileResponse.fromJson);
|
||||
}
|
||||
|
||||
/// Send an image to this channel
|
||||
Future<SendImageResponse> sendImage(MultipartFile file) async {
|
||||
Future<SendImageResponse> sendImage(
|
||||
MultipartFile file, {
|
||||
ProgressCallback onSendProgress,
|
||||
}) async {
|
||||
final response = await _client.post(
|
||||
'$_channelURL/image',
|
||||
data: FormData.fromMap({'file': file}),
|
||||
onSendProgress: onSendProgress,
|
||||
);
|
||||
return _client.decode(response.data, SendImageResponse.fromJson);
|
||||
}
|
||||
|
||||
@@ -794,9 +794,14 @@ class StreamChatClient {
|
||||
Future<Response<String>> post(
|
||||
String path, {
|
||||
dynamic data,
|
||||
ProgressCallback onSendProgress,
|
||||
}) async {
|
||||
try {
|
||||
final response = await httpClient.post<String>(path, data: data);
|
||||
final response = await httpClient.post<String>(
|
||||
path,
|
||||
data: data,
|
||||
onSendProgress: onSendProgress,
|
||||
);
|
||||
return response;
|
||||
} on DioError catch (error) {
|
||||
throw _parseError(error);
|
||||
|
||||
@@ -2,6 +2,7 @@ library stream_chat;
|
||||
|
||||
export 'package:dio/src/dio_error.dart';
|
||||
export 'package:dio/src/multipart_file.dart';
|
||||
export 'package:dio/src/options.dart' show ProgressCallback;
|
||||
export 'package:logging/logging.dart' show Logger, Level;
|
||||
|
||||
export './src/api/channel.dart';
|
||||
|
||||
Reference in New Issue
Block a user