mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add headers to options
This commit is contained in:
@@ -10,6 +10,8 @@ import { ContactsPage } from '../new-group/contacts/contacts.page';
|
||||
import { Router } from '@angular/router';
|
||||
import { connection } from 'src/app/services/socket/synchro.service';
|
||||
import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page';
|
||||
import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
|
||||
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-messages',
|
||||
@@ -38,6 +40,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
|
||||
connection = connection;
|
||||
chatMessageStore = ChatMessageStore
|
||||
chatUserStorage = ChatUserStorage
|
||||
|
||||
scrollingOnce:boolean = true;
|
||||
private scrollChangeCallback: () => void;
|
||||
currentPosition: any;
|
||||
@@ -164,9 +169,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
loadMessages(){
|
||||
//this.showLoader = true;
|
||||
const roomId = this.roomId
|
||||
this.chatService.getRoomMessages(this.roomId).subscribe(res => {
|
||||
console.log(res);
|
||||
this.messages = res['messages'].reverse();
|
||||
this.chatMessageStore.add(roomId, this.messages)
|
||||
|
||||
console.log(this.messages);
|
||||
//this.serverLongPull(res)
|
||||
/* this.chatService.subscribe(this.roomId).then(res => {
|
||||
@@ -176,7 +184,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
})
|
||||
}
|
||||
|
||||
getChatMembers(){
|
||||
getChatMembers() {
|
||||
console.log(this.roomId);
|
||||
|
||||
//this.showLoader = true;
|
||||
@@ -339,7 +347,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
});
|
||||
}
|
||||
|
||||
async serverLongPull(){
|
||||
async serverLongPull() {
|
||||
|
||||
const roomId = this.roomId
|
||||
this.chatService.getRoomMessages(this.roomId).subscribe(async res => {
|
||||
|
||||
if (res == 502) {
|
||||
@@ -352,6 +362,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
//showMessage(response.statusText);
|
||||
//this.loadMessages()
|
||||
this.messages = res['messages'].reverse();
|
||||
this.chatMessageStore.add(roomId, this.messages)
|
||||
console.log(this.messages);
|
||||
// Reconnect in one second
|
||||
if(this.route.url != "/home/chat"){
|
||||
|
||||
Reference in New Issue
Block a user