Merge with websocket branch

This commit is contained in:
Eudes Inácio
2022-01-19 09:12:30 +01:00
46 changed files with 1631 additions and 729 deletions
+13 -5
View File
@@ -29,6 +29,7 @@ import { elementAt } from 'rxjs-compat/operator/elementAt';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { HttpEventType } from '@angular/common/http';
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'
const IMAGE_DIR = 'stored-images';
@@ -97,7 +98,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
public ThemeService: ThemeService,
private changeDetectorRef: ChangeDetectorRef,
private platform: Platform,
private sqlservice: SqliteService
private sqlservice: SqliteService,
public wsChatMethodsService: WsChatMethodsService
) {
this.loggedUser = authService.ValidatedUserChat['data'];
this.roomId = this.navParams.get('roomId');
@@ -108,10 +110,18 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.modalController.dismiss();
}
};
this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory()
this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
setTimeout(()=>{
this.scrollToBottomClicked()
}, 50)
}
ngOnInit() {
this.load();
//this.load();
this.setStatus('online');
//this.loadFiles();
@@ -281,7 +291,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
} catch (err) { }
}
scrollToBottomClicked(): void {
scrollToBottomClicked = () => {
try {
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
} catch (err) { }
@@ -333,8 +343,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
window.removeEventListener('scroll', this.scrollChangeCallback, true);
}
sendMessage() {
let body = {
"message":