mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-18 18:33:49 +02:00
Merge pull request #66 from Iconica-Development/bugfix/feedback
fix: apply feedback
This commit is contained in:
commit
c370df0bdd
10 changed files with 58 additions and 12 deletions
|
@ -1,3 +1,9 @@
|
|||
## 1.4.2
|
||||
|
||||
- Added doc comments
|
||||
- Fixed bug when creating a group chat with the `LocalChatService`
|
||||
- Updated readme
|
||||
|
||||
## 1.4.1
|
||||
- Made UI changes to match the Figma design
|
||||
|
||||
|
|
21
README.md
21
README.md
|
@ -18,6 +18,14 @@ To use this package, add flutter_chat as a dependency in your pubspec.yaml file:
|
|||
path: packages/flutter_chat
|
||||
```
|
||||
|
||||
You can use the `LocalChatService` to test the package in your project:
|
||||
|
||||
```
|
||||
ChatUserStoryConfiguration(
|
||||
chatService: LocalChatService(),
|
||||
),
|
||||
```
|
||||
|
||||
If you are going to use Firebase as the back-end of the Chat, you should also add the following package as a dependency to your pubspec.yaml file:
|
||||
|
||||
```
|
||||
|
@ -32,7 +40,18 @@ Create a Firebase project for your application and add firebase firestore and st
|
|||
make sure you are authenticated using the `Firebase_auth` package or adjust your firebase rules, otherwise you won't be able to retreive data.
|
||||
|
||||
Also make sure you have the corresponding collections in your firebase project as defined in `FirebaseChatOptions`, you can override the
|
||||
default paths as you wish, also the structure of your data should be equal to our predefined models, you can implement any model by making your own model and implementing one of the predefined interfaces like so:
|
||||
default paths as you wish:
|
||||
```
|
||||
const FirebaseChatOptions({
|
||||
this.groupChatsCollectionName = 'group_chats',
|
||||
this.chatsCollectionName = 'chats',
|
||||
this.messagesCollectionName = 'messages',
|
||||
this.usersCollectionName = 'users',
|
||||
this.chatsMetaDataCollectionName = 'chat_metadata',
|
||||
this.userChatsCollectionName = 'chats',
|
||||
});
|
||||
```
|
||||
Also the structure of your data should be equal to our predefined models, you can implement any model by making your own model and implementing one of the predefined interfaces like so:
|
||||
|
||||
```
|
||||
class ChatMessageModel implements ChatMessageModelInterface {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_chat
|
||||
description: A new Flutter package project.
|
||||
version: 1.4.1
|
||||
version: 1.4.2
|
||||
|
||||
publish_to: none
|
||||
|
||||
|
@ -20,17 +20,17 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_chat
|
||||
path: packages/flutter_chat_view
|
||||
ref: 1.4.1
|
||||
ref: 1.4.2
|
||||
flutter_chat_interface:
|
||||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_chat
|
||||
path: packages/flutter_chat_interface
|
||||
ref: 1.4.1
|
||||
ref: 1.4.2
|
||||
flutter_chat_local:
|
||||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_chat
|
||||
path: packages/flutter_chat_local
|
||||
ref: 1.4.1
|
||||
ref: 1.4.2
|
||||
uuid: ^4.3.3
|
||||
|
||||
dev_dependencies:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_chat_firebase
|
||||
description: A new Flutter package project.
|
||||
version: 1.4.1
|
||||
version: 1.4.2
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
|
@ -23,7 +23,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_chat
|
||||
path: packages/flutter_chat_interface
|
||||
ref: 1.4.1
|
||||
ref: 1.4.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_iconica_analysis:
|
||||
|
|
|
@ -1,11 +1,25 @@
|
|||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
||||
|
||||
abstract class ChatOverviewService {
|
||||
/// Retrieves a stream of chats.
|
||||
/// This stream is updated whenever a new chat is created.
|
||||
Stream<List<ChatModel>> getChatsStream();
|
||||
|
||||
/// Retrieves a chat based on the user.
|
||||
Future<ChatModel> getChatByUser(ChatUserModel user);
|
||||
|
||||
/// Retrieves a chat based on the ID.
|
||||
Future<ChatModel> getChatById(String id);
|
||||
|
||||
/// Deletes the chat for this user and the other users in the chat.
|
||||
Future<void> deleteChat(ChatModel chat);
|
||||
|
||||
/// When a chat is read, this method is called.
|
||||
Future<void> readChat(ChatModel chat);
|
||||
|
||||
/// Creates the chat if it does not exist.
|
||||
Future<ChatModel> storeChatIfNot(ChatModel chat);
|
||||
|
||||
/// Retrieves the number of unread chats.
|
||||
Stream<int> getUnreadChatsCountStream();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
||||
|
||||
abstract class ChatUserService {
|
||||
/// Retrieves a user based on the ID.
|
||||
Future<ChatUserModel?> getUser(String id);
|
||||
|
||||
/// Retrieves the current user.
|
||||
/// This is the user that is currently logged in.
|
||||
Future<ChatUserModel?> getCurrentUser();
|
||||
|
||||
/// Retrieves all users. Used for chat creation.
|
||||
Future<List<ChatUserModel>> getAllUsers();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_chat_interface
|
||||
description: A new Flutter package project.
|
||||
version: 1.4.1
|
||||
version: 1.4.2
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
|
|
|
@ -81,6 +81,7 @@ class LocalChatOverviewService
|
|||
var chatExists = _chats.any((element) => element.id == chat.id);
|
||||
|
||||
if (!chatExists) {
|
||||
chat.id = chat.hashCode.toString();
|
||||
_chats.add(chat);
|
||||
_chatsController.add([..._chats]);
|
||||
notifyListeners();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_chat_local
|
||||
description: "A new Flutter package project."
|
||||
version: 1.4.1
|
||||
version: 1.4.2
|
||||
publish_to: none
|
||||
homepage:
|
||||
|
||||
|
@ -15,7 +15,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_chat
|
||||
path: packages/flutter_chat_interface
|
||||
ref: 1.4.1
|
||||
ref: 1.4.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_chat_view
|
||||
description: A standard flutter package.
|
||||
version: 1.4.1
|
||||
version: 1.4.2
|
||||
|
||||
publish_to: none
|
||||
|
||||
|
@ -20,7 +20,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_chat
|
||||
path: packages/flutter_chat_interface
|
||||
ref: 1.4.1
|
||||
ref: 1.4.2
|
||||
cached_network_image: ^3.2.2
|
||||
flutter_image_picker:
|
||||
git:
|
||||
|
|
Loading…
Reference in a new issue