mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 10:53:51 +02:00
feat: testing breaking API changes with melos
This commit is contained in:
parent
15f15748b6
commit
0a0e14d5f0
6 changed files with 15 additions and 12 deletions
|
@ -241,7 +241,7 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
///
|
///
|
||||||
/// [chatId]: The ID of the chat.
|
/// [chatId]: The ID of the chat.
|
||||||
@override
|
@override
|
||||||
Future<ChatModel> getChatById(String chatId) async {
|
Future<ChatModel> getChatById(String chatId, String iamBreakingStuff) async {
|
||||||
var currentUser = await _userService.getCurrentUser();
|
var currentUser = await _userService.getCurrentUser();
|
||||||
var chatCollection = await _db
|
var chatCollection = await _db
|
||||||
.collection(_options.usersCollectionName)
|
.collection(_options.usersCollectionName)
|
||||||
|
|
|
@ -9,7 +9,7 @@ abstract class ChatOverviewService {
|
||||||
Future<ChatModel> getChatByUser(ChatUserModel user);
|
Future<ChatModel> getChatByUser(ChatUserModel user);
|
||||||
|
|
||||||
/// Retrieves a chat based on the ID.
|
/// Retrieves a chat based on the ID.
|
||||||
Future<ChatModel> getChatById(String id);
|
Future<ChatModel> getChatById(String id, String iamBreakingStuff);
|
||||||
|
|
||||||
/// Deletes the chat for this user and the other users in the chat.
|
/// Deletes the chat for this user and the other users in the chat.
|
||||||
Future<void> deleteChat(ChatModel chat);
|
Future<void> deleteChat(ChatModel chat);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
|
||||||
int pageSize,
|
int pageSize,
|
||||||
String chatId,
|
String chatId,
|
||||||
) async {
|
) async {
|
||||||
var value = await chatOverviewService.getChatById(chatId);
|
var value = await chatOverviewService.getChatById(chatId, "test");
|
||||||
_cumulativeMessages.clear();
|
_cumulativeMessages.clear();
|
||||||
if (value.messages != null) {
|
if (value.messages != null) {
|
||||||
_cumulativeMessages.addAll(value.messages!);
|
_cumulativeMessages.addAll(value.messages!);
|
||||||
|
@ -46,8 +46,10 @@ class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
|
||||||
String chatId,
|
String chatId,
|
||||||
) {
|
) {
|
||||||
_controller.onListen = () async {
|
_controller.onListen = () async {
|
||||||
_subscription =
|
_subscription = chatOverviewService
|
||||||
chatOverviewService.getChatById(chatId).asStream().listen((event) {
|
.getChatById(chatId, "test")
|
||||||
|
.asStream()
|
||||||
|
.listen((event) {
|
||||||
if (event.messages != null) {
|
if (event.messages != null) {
|
||||||
_cumulativeMessages.clear();
|
_cumulativeMessages.clear();
|
||||||
_cumulativeMessages.addAll(event.messages!);
|
_cumulativeMessages.addAll(event.messages!);
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LocalChatOverviewService
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<ChatModel> getChatById(String id) {
|
Future<ChatModel> getChatById(String id, String iamBreakingStuff) {
|
||||||
var chat = _chats.firstWhere((element) => element.id == id);
|
var chat = _chats.firstWhere((element) => element.id == id);
|
||||||
debugPrint("Retrieved chat by ID: $chat");
|
debugPrint("Retrieved chat by ID: $chat");
|
||||||
debugPrint("Messages are: ${chat.messages?.length}");
|
debugPrint("Messages are: ${chat.messages?.length}");
|
||||||
|
|
|
@ -80,8 +80,8 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
||||||
messageSubscription = widget.service.chatDetailService;
|
messageSubscription = widget.service.chatDetailService;
|
||||||
messageSubscription.addListener(onListen);
|
messageSubscription.addListener(onListen);
|
||||||
Future.delayed(Duration.zero, () async {
|
Future.delayed(Duration.zero, () async {
|
||||||
chat =
|
chat = await widget.service.chatOverviewService
|
||||||
await widget.service.chatOverviewService.getChatById(widget.chatId);
|
.getChatById(widget.chatId, "");
|
||||||
|
|
||||||
if (detailRows.isEmpty && context.mounted) {
|
if (detailRows.isEmpty && context.mounted) {
|
||||||
await widget.service.chatDetailService.fetchMoreMessage(
|
await widget.service.chatDetailService.fetchMoreMessage(
|
||||||
|
@ -164,7 +164,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
||||||
|
|
||||||
return FutureBuilder<ChatModel>(
|
return FutureBuilder<ChatModel>(
|
||||||
// ignore: discarded_futures
|
// ignore: discarded_futures
|
||||||
future: widget.service.chatOverviewService.getChatById(widget.chatId),
|
future: widget.service.chatOverviewService.getChatById(widget.chatId, ""),
|
||||||
builder: (context, AsyncSnapshot<ChatModel> snapshot) {
|
builder: (context, AsyncSnapshot<ChatModel> snapshot) {
|
||||||
var chatModel = snapshot.data;
|
var chatModel = snapshot.data;
|
||||||
var chatTitle = (chatModel is GroupChatModel)
|
var chatTitle = (chatModel is GroupChatModel)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: discarded_futures
|
||||||
|
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:flutter_chat_view/flutter_chat_view.dart";
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
import "package:flutter_profile/flutter_profile.dart";
|
import "package:flutter_profile/flutter_profile.dart";
|
||||||
|
@ -38,9 +40,8 @@ class _ProfileScreenState extends State<ChatProfileScreen> {
|
||||||
var theme = Theme.of(context);
|
var theme = Theme.of(context);
|
||||||
return FutureBuilder<dynamic>(
|
return FutureBuilder<dynamic>(
|
||||||
future: hasUser
|
future: hasUser
|
||||||
// ignore: discarded_futures
|
? widget.chatService.chatOverviewService
|
||||||
? widget.chatService.chatOverviewService.getChatById(widget.chatId)
|
.getChatById(widget.chatId, "")
|
||||||
// ignore: discarded_futures
|
|
||||||
: widget.chatService.chatUserService.getUser(widget.userId!),
|
: widget.chatService.chatUserService.getUser(widget.userId!),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
var data = snapshot.data;
|
var data = snapshot.data;
|
||||||
|
|
Loading…
Reference in a new issue