mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-18 18:33:49 +02:00
feat: add senderId and chatId to uploadImage
This commit is contained in:
parent
e7bb4909ba
commit
23f61dd5ff
6 changed files with 15 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
||||||
- Added chatTitleResolver that can be used to resolve the chat title from the chat model or return null to allow for default behavior
|
- Added chatTitleResolver that can be used to resolve the chat title from the chat model or return null to allow for default behavior
|
||||||
- Added ChatPaginationControls to the ChatOptions to allow for more control over the pagination
|
- Added ChatPaginationControls to the ChatOptions to allow for more control over the pagination
|
||||||
- Fixed that chat message is automatically sent when the user presses enter on the keyboard in the chat input
|
- Fixed that chat message is automatically sent when the user presses enter on the keyboard in the chat input
|
||||||
|
- Added sender and chatId to uploadImage in the ChatRepositoryInterface
|
||||||
|
|
||||||
## 4.0.0
|
## 4.0.0
|
||||||
- Move to the new user story architecture
|
- Move to the new user story architecture
|
||||||
|
|
|
@ -105,9 +105,13 @@ abstract class ChatRepositoryInterface {
|
||||||
/// Upload an image with the given parameters.
|
/// Upload an image with the given parameters.
|
||||||
/// [path] is the path of the image.
|
/// [path] is the path of the image.
|
||||||
/// [image] is the image data.
|
/// [image] is the image data.
|
||||||
|
/// [senderId] is the sender id.
|
||||||
|
/// [chatId] is the chat id.
|
||||||
/// Returns the image url.
|
/// Returns the image url.
|
||||||
Future<String> uploadImage({
|
Future<String> uploadImage({
|
||||||
required String path,
|
required String path,
|
||||||
|
required String senderId,
|
||||||
|
required String chatId,
|
||||||
required Uint8List image,
|
required Uint8List image,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,6 +268,8 @@ class LocalChatRepository implements ChatRepositoryInterface {
|
||||||
Future<String> uploadImage({
|
Future<String> uploadImage({
|
||||||
required String path,
|
required String path,
|
||||||
required Uint8List image,
|
required Uint8List image,
|
||||||
|
required String chatId,
|
||||||
|
required String senderId,
|
||||||
}) =>
|
}) =>
|
||||||
Future.value("https://picsum.photos/200/300");
|
Future.value("https://picsum.photos/200/300");
|
||||||
|
|
||||||
|
|
|
@ -211,14 +211,18 @@ class ChatService {
|
||||||
/// Upload an image with the given parameters.
|
/// Upload an image with the given parameters.
|
||||||
/// [path] is the image path.
|
/// [path] is the image path.
|
||||||
/// [image] is the image bytes.
|
/// [image] is the image bytes.
|
||||||
|
/// [chatId] is the chat id.
|
||||||
/// Returns a [Future] of [String].
|
/// Returns a [Future] of [String].
|
||||||
Future<String> uploadImage({
|
Future<String> uploadImage({
|
||||||
required String path,
|
required String path,
|
||||||
required Uint8List image,
|
required Uint8List image,
|
||||||
|
required String chatId,
|
||||||
}) =>
|
}) =>
|
||||||
chatRepository.uploadImage(
|
chatRepository.uploadImage(
|
||||||
path: path,
|
path: path,
|
||||||
image: image,
|
image: image,
|
||||||
|
senderId: userId,
|
||||||
|
chatId: chatId,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Mark the chat as read with the given parameters.
|
/// Mark the chat as read with the given parameters.
|
||||||
|
|
|
@ -190,6 +190,8 @@ class FirebaseChatRepository implements ChatRepositoryInterface {
|
||||||
Future<String> uploadImage({
|
Future<String> uploadImage({
|
||||||
required String path,
|
required String path,
|
||||||
required Uint8List image,
|
required Uint8List image,
|
||||||
|
required String chatId,
|
||||||
|
required String senderId,
|
||||||
}) async {
|
}) async {
|
||||||
var ref = _storage.ref().child(_mediaPath).child(path);
|
var ref = _storage.ref().child(_mediaPath).child(path);
|
||||||
var uploadTask = ref.putData(image);
|
var uploadTask = ref.putData(image);
|
||||||
|
|
|
@ -54,6 +54,7 @@ MaterialPageRoute chatDetailRoute({
|
||||||
var path = await chatService.uploadImage(
|
var path = await chatService.uploadImage(
|
||||||
path: "chats/$chatId-$userId-${DateTime.now()}",
|
path: "chats/$chatId-$userId-${DateTime.now()}",
|
||||||
image: data,
|
image: data,
|
||||||
|
chatId: chatId,
|
||||||
);
|
);
|
||||||
await chatService.sendMessage(
|
await chatService.sendMessage(
|
||||||
messageId: "$chatId-$userId-${DateTime.now()}",
|
messageId: "$chatId-$userId-${DateTime.now()}",
|
||||||
|
@ -213,6 +214,7 @@ MaterialPageRoute _newGroupChatOverviewRoute({
|
||||||
path = await chatService.uploadImage(
|
path = await chatService.uploadImage(
|
||||||
path: "groups/$title",
|
path: "groups/$title",
|
||||||
image: image,
|
image: image,
|
||||||
|
chatId: "",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var chat = await _createGroupChat(
|
var chat = await _createGroupChat(
|
||||||
|
|
Loading…
Reference in a new issue