mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
save
This commit is contained in:
@@ -29,7 +29,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
dmUsers:any;
|
||||
|
||||
@Input() roomId:string;
|
||||
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
private modalController: ModalController,
|
||||
@@ -39,33 +39,30 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
private animationController: AnimationController,
|
||||
private alertService: AlertService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
|
||||
/* this.dm = this.navParams.get('dm'); */
|
||||
}
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
console.log(this.roomId);
|
||||
this.load();
|
||||
|
||||
|
||||
//throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.scrollToBottom();
|
||||
//this.scrollToBottom();
|
||||
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
console.log(this.loggedUser);
|
||||
});
|
||||
|
||||
/* setInterval(()=>{ */
|
||||
this.load();
|
||||
/* }, 9000); */
|
||||
console.log(this.roomId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
notImplemented(){
|
||||
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
|
||||
}
|
||||
@@ -80,22 +77,22 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
this.load();
|
||||
ev.target.complete();
|
||||
}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
this.scrollToBottom();
|
||||
|
||||
ngAfterViewChecked() {
|
||||
//this.scrollToBottom();
|
||||
console.log(this.roomId);
|
||||
}
|
||||
scrollToBottom(): void {
|
||||
}
|
||||
/* scrollToBottom(): void {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
|
||||
} catch(err) { }
|
||||
} catch(err) { }
|
||||
finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} */
|
||||
loadMoreMessages(ev:any){
|
||||
|
||||
}
|
||||
@@ -103,18 +100,18 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
sendMessage(){
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
this.loadMessages();
|
||||
this.loadMessages();
|
||||
});
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
|
||||
loadMessages(){
|
||||
this.showLoader = true;
|
||||
this.chatService.getRoomMessages(this.roomId).subscribe(res => {
|
||||
@@ -126,7 +123,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
}
|
||||
getChatMembers(){
|
||||
console.log(this.roomId);
|
||||
|
||||
|
||||
this.showLoader = true;
|
||||
this.chatService.getMembers(this.roomId).subscribe(res=> {
|
||||
this.dmUsers = res['members'].filter(data => data.username != this.loggedUser.me.username)
|
||||
@@ -152,7 +149,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
async addContacts(){
|
||||
const modal = await this.modalController.create({
|
||||
component: ContactsPage,
|
||||
componentProps: {},
|
||||
componentProps: {},
|
||||
cssClass: 'contacts',
|
||||
backdropDismiss: false
|
||||
});
|
||||
@@ -209,7 +206,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* const popover = await this.popoverController.create({
|
||||
component: MessagesOptionsPage,
|
||||
@@ -234,7 +231,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
return await modal.present();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async _openChatOptions() {
|
||||
|
||||
@@ -260,7 +257,7 @@ export class MessagesPage implements OnInit, AfterViewChecked, OnChanges {
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* const popover = await this.popoverController.create({
|
||||
component: MessagesOptionsPage,
|
||||
|
||||
Reference in New Issue
Block a user