add headers to options

This commit is contained in:
Peter Maquiran
2021-08-24 14:07:27 +01:00
parent 567209ed4b
commit 019b85d209
16 changed files with 184 additions and 32 deletions
+13 -2
View File
@@ -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"){