diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index f589e9f12..9b97b2244 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -49,7 +49,7 @@ -->
-
diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index aff6d21fa..bad98da93 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -108,7 +108,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { } }; - this.wsChatMethodsService.getRoom(this.roomId).loadHistory() + this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory() } diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index a98ef4b43..587d052f0 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -41,7 +41,6 @@ export class LoginPage implements OnInit { private changeProfileService: ChangeProfileService, public ThemeService: ThemeService, private storageservice: StorageService, - private chatService: ChatService, ) {} ngOnInit() { @@ -102,7 +101,7 @@ export class LoginPage implements OnInit { // login to API successfully if (attempt) { - if (attempt.UserId == SessionStore.user.UserId) { + if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); await this.authService.loginChat(this.userattempt); this.getToken(); diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index af1114b56..897d610bf 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -73,8 +73,8 @@ export class RoomService { this.massages.push(wewMessage) }); - }) + }) this.hasLoadHistory = true } diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index aa7a30a8c..99d67d1a9 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -88,12 +88,16 @@ export class WsChatMethodsService { } } - getRoom(id): RoomService { + getDmRoom(id): RoomService { try { return this.dm[id] - } catch(e) { + } catch(e) {} + } + + getGroupRoom(id): RoomService { + try { return this.group[id] - } + } catch(e) {} } getRoomName(roomData: room) { diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html index ae59a74df..5c4a8fa22 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -44,7 +44,7 @@ A conversa original mantêm-se como chat individual
-
+
diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 793134b59..fc13c348c 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -90,7 +90,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe private fileService: FileService, public ThemeService: ThemeService, private changeDetectorRef: ChangeDetectorRef, - //public wsChatMethodsService: WsChatMethodsService + public wsChatMethodsService: WsChatMethodsService ) { this.loggedUserChat = authService.ValidatedUserChat['data']; this.isGroupCreated = true; @@ -101,11 +101,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe ngOnChanges(changes: SimpleChanges): void { this.getRoomInfo(); //this.scrollToBottom(); - //this.wsChatMethodsService.getRoom(this.roomId).loadHistory(); + this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory(); + console.log('MESSAGES'+this.wsChatMethodsService.getGroupRoom(this.roomId).massages); } ngOnInit() { - alert('Here') //console.log(this.wsChatMethodsService.getRoom(this.roomId).massages); this.loggedUser=this.loggedUserChat; diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index df633ae84..053c88603 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -37,7 +37,7 @@
-
+
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 7079eb39e..51577d937 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -84,7 +84,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy this.loggedUser = authService.ValidatedUserChat['data']; } ngOnChanges(changes: SimpleChanges): void { - this.wsChatMethodsService.getRoom(this.roomId).loadHistory() + this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory() } ngOnInit() { @@ -214,7 +214,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } sendMessage() { - this.wsChatMethodsService.getRoom(this.roomId).send(this.message) + this.wsChatMethodsService.getDmRoom(this.roomId).send(this.message) this.message = ""; }