revert feat(app): Server changed to dev2
This commit is contained in:
2024-08-02 07:29:32 +00:00
parent c83bfee7cc
commit f3d099fe0c
3 changed files with 14 additions and 32 deletions

View File

@@ -1 +1 @@
const String baseUrl = 'https://dev2.eatvio.ru';
const String baseUrl = 'https://mobile-stage.eatvio.ru';

View File

@@ -11,18 +11,13 @@ class InitializationCubit extends Cubit<InitializationState> {
final ChatRepository chatRepository;
bool wasInitialized = false;
InitializationCubit({required this.chatRepository})
: super(const InitializationState.loading());
InitializationCubit({required this.chatRepository}) : super(const InitializationState.loading());
Future<void> subscribeNotifications(
int userId, PusherChannelsClient client) async {
Future<void> 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<InitializationState> {
});
}
Future<void> subscribeChatMessages(
int userId, PusherChannelsClient client) async {
Future<void> 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()}',
},

View File

@@ -39,16 +39,12 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
));
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<ChatRoomState> {
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<ChatRoomState> {
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()}',
},