Skip to content

Commit

Permalink
feat: testing breaking API changes with melos
Browse files Browse the repository at this point in the history
  • Loading branch information
freekvandeven committed Jul 1, 2024
1 parent 15f1574 commit 4a850c1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class FirebaseChatOverviewService implements ChatOverviewService {
///
/// [chatId]: The ID of the chat.
@override
Future<ChatModel> getChatById(String chatId) async {
Future<ChatModel> getChatById(String chatId, String iamBreakingStuff) async {
var currentUser = await _userService.getCurrentUser();
var chatCollection = await _db
.collection(_options.usersCollectionName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ abstract class ChatOverviewService {
Future<ChatModel> getChatByUser(ChatUserModel user);

/// 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.
Future<void> deleteChat(ChatModel chat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
int pageSize,
String chatId,
) async {
var value = await chatOverviewService.getChatById(chatId);
var value = await chatOverviewService.getChatById(chatId, "test");
_cumulativeMessages.clear();
if (value.messages != null) {
_cumulativeMessages.addAll(value.messages!);
Expand All @@ -46,8 +46,10 @@ class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
String chatId,
) {
_controller.onListen = () async {
_subscription =
chatOverviewService.getChatById(chatId).asStream().listen((event) {
_subscription = chatOverviewService
.getChatById(chatId, "test")
.asStream()
.listen((event) {
if (event.messages != null) {
_cumulativeMessages.clear();
_cumulativeMessages.addAll(event.messages!);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class LocalChatOverviewService
}

@override
Future<ChatModel> getChatById(String id) {
Future<ChatModel> getChatById(String id, String iamBreakingStuff) {
var chat = _chats.firstWhere((element) => element.id == id);
debugPrint("Retrieved chat by ID: $chat");
debugPrint("Messages are: ${chat.messages?.length}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
messageSubscription = widget.service.chatDetailService;
messageSubscription.addListener(onListen);
Future.delayed(Duration.zero, () async {
chat =
await widget.service.chatOverviewService.getChatById(widget.chatId);
chat = await widget.service.chatOverviewService
.getChatById(widget.chatId, "");

if (detailRows.isEmpty && context.mounted) {
await widget.service.chatDetailService.fetchMoreMessage(
Expand Down Expand Up @@ -164,7 +164,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {

return FutureBuilder<ChatModel>(
// ignore: discarded_futures
future: widget.service.chatOverviewService.getChatById(widget.chatId),
future: widget.service.chatOverviewService.getChatById(widget.chatId, ""),
builder: (context, AsyncSnapshot<ChatModel> snapshot) {
var chatModel = snapshot.data;
var chatTitle = (chatModel is GroupChatModel)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: discarded_futures

import "package:flutter/material.dart";
import "package:flutter_chat_view/flutter_chat_view.dart";
import "package:flutter_profile/flutter_profile.dart";
Expand Down Expand Up @@ -38,9 +40,8 @@ class _ProfileScreenState extends State<ChatProfileScreen> {
var theme = Theme.of(context);
return FutureBuilder<dynamic>(
future: hasUser
// ignore: discarded_futures
? widget.chatService.chatOverviewService.getChatById(widget.chatId)
// ignore: discarded_futures
? widget.chatService.chatOverviewService
.getChatById(widget.chatId, "")
: widget.chatService.chatUserService.getUser(widget.userId!),
builder: (context, snapshot) {
var data = snapshot.data;
Expand Down

0 comments on commit 4a850c1

Please sign in to comment.