From f3d099fe0c938d8b0e09f1c0660f510340028100 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Fri, 2 Aug 2024 07:29:32 +0000 Subject: [PATCH] revert c83bfee7cc81552fcd6a716723d6d0e786e704e2 revert feat(app): Server changed to dev2 --- lib/core/constants/constants.dart | 2 +- .../initialization_cubit.dart | 23 ++++++------------- .../bloc/chat_room_cubit/chat_room_cubit.dart | 21 +++++------------ 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/lib/core/constants/constants.dart b/lib/core/constants/constants.dart index 4daf5231..c0353c48 100644 --- a/lib/core/constants/constants.dart +++ b/lib/core/constants/constants.dart @@ -1 +1 @@ -const String baseUrl = 'https://dev2.eatvio.ru'; +const String baseUrl = 'https://mobile-stage.eatvio.ru'; diff --git a/lib/core/initialization_cubit/initialization_cubit.dart b/lib/core/initialization_cubit/initialization_cubit.dart index dd06a97a..4a1bcaf2 100644 --- a/lib/core/initialization_cubit/initialization_cubit.dart +++ b/lib/core/initialization_cubit/initialization_cubit.dart @@ -11,18 +11,13 @@ class InitializationCubit extends Cubit { final ChatRepository chatRepository; bool wasInitialized = false; - InitializationCubit({required this.chatRepository}) - : super(const InitializationState.loading()); + InitializationCubit({required this.chatRepository}) : super(const InitializationState.loading()); - Future subscribeNotifications( - int userId, PusherChannelsClient client) async { + Future subscribeNotifications(int userId, PusherChannelsClient client) async { final privateNotificationChannel = await client.privateChannel( 'private-message-events.$userId', - authorizationDelegate: - EndpointAuthorizableChannelTokenAuthorizationDelegate - .forPrivateChannel( - authorizationEndpoint: - Uri.parse('https://dev2.eatvio.ru/broadcasting/auth'), + authorizationDelegate: EndpointAuthorizableChannelTokenAuthorizationDelegate.forPrivateChannel( + authorizationEndpoint: Uri.parse('https://mobile-stage.eatvio.ru/broadcasting/auth'), headers: { 'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}', }, @@ -36,15 +31,11 @@ class InitializationCubit extends Cubit { }); } - Future subscribeChatMessages( - int userId, PusherChannelsClient client) async { + Future subscribeChatMessages(int userId, PusherChannelsClient client) async { final privateMessagesChannel = await client.privateChannel( 'private-new-chat-messages.$userId', - authorizationDelegate: - EndpointAuthorizableChannelTokenAuthorizationDelegate - .forPrivateChannel( - authorizationEndpoint: - Uri.parse('https://dev2.eatvio.ru/broadcasting/auth'), + authorizationDelegate: EndpointAuthorizableChannelTokenAuthorizationDelegate.forPrivateChannel( + authorizationEndpoint: Uri.parse('https://mobile-stage.eatvio.ru/broadcasting/auth'), headers: { 'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}', }, diff --git a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart index 49ab7678..3773c43c 100644 --- a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart +++ b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart @@ -39,16 +39,12 @@ class ChatRoomCubit extends Cubit { )); try { - final chatMessages = - await chatRepository.getChatMessages(chatId, currentPage + 1); + final chatMessages = await chatRepository.getChatMessages(chatId, currentPage + 1); isLoading = false; emit(ChatRoomState.loaded( chatRoom: (state as ChatRoomStateLoaded).chatRoom, - chatMessages: [ - ...(state as ChatRoomStateLoaded).chatMessages, - ...chatMessages.messagesList - ], + chatMessages: [...(state as ChatRoomStateLoaded).chatMessages, ...chatMessages.messagesList], isTyping: (state as ChatRoomStateLoaded).isTyping, isLoading: isLoading, )); @@ -65,12 +61,10 @@ class ChatRoomCubit extends Cubit { try { final chatRoom = await chatRepository.getChatRoom(chatId); - final chatMessages = - await chatRepository.getChatMessages(chatId, currentPage); + final chatMessages = await chatRepository.getChatMessages(chatId, currentPage); lastPage = chatMessages.meta.lastPage; - await subscribeToChatChannel( - initCubit: initializationCubit, chatId: chatId); + await subscribeToChatChannel(initCubit: initializationCubit, chatId: chatId); emit(ChatRoomState.loaded( chatRoom: chatRoom, @@ -92,11 +86,8 @@ class ChatRoomCubit extends Cubit { privateChatChannel = await client.privateChannel( 'private-direct-chat.$chatId', - authorizationDelegate: - EndpointAuthorizableChannelTokenAuthorizationDelegate - .forPrivateChannel( - authorizationEndpoint: - Uri.parse('https://dev2.eatvio.ru/broadcasting/auth'), + authorizationDelegate: EndpointAuthorizableChannelTokenAuthorizationDelegate.forPrivateChannel( + authorizationEndpoint: Uri.parse('https://mobile-stage.eatvio.ru/broadcasting/auth'), headers: { 'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}', },