mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Update
This commit is contained in:
@@ -10,6 +10,7 @@ import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/mes
|
||||
import { ProfileComponent } from '../../headers/header-no-search/profile/profile.page';
|
||||
import { ContactsPage } from '../new-group/contacts/contacts.page';
|
||||
import { Router } from '@angular/router';
|
||||
import { connection } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-messages',
|
||||
@@ -33,6 +34,9 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
@Input() roomId:string;
|
||||
@Input() showMessages:string;
|
||||
|
||||
|
||||
connection = connection
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
private modalController: ModalController,
|
||||
@@ -46,6 +50,21 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
|
||||
|
||||
|
||||
this.connection.callback = function() {
|
||||
this.chatService.getRoomMessages(this.roomId).subscribe(async res => {
|
||||
|
||||
if (res == 502) {
|
||||
|
||||
} else if (res != 200) {
|
||||
this.messages = res['messages'].reverse();
|
||||
console.log(this.messages);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* this.dm = this.navParams.get('dm'); */
|
||||
}
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
@@ -103,7 +122,9 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage(){
|
||||
sendMessage() {
|
||||
|
||||
this.connection.$send({})
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
@@ -292,7 +313,8 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
return await modal.present();
|
||||
}
|
||||
|
||||
async serverLongPull(){
|
||||
async serverLongPull() {
|
||||
|
||||
this.chatService.getRoomMessages(this.roomId).subscribe(async res => {
|
||||
|
||||
if (res == 502) {
|
||||
|
||||
Reference in New Issue
Block a user