add delete message feature to groups view

This commit is contained in:
tiago.kayaya
2021-09-30 12:23:22 +01:00
parent bc961c3ce1
commit 7e05f9570a
4 changed files with 96 additions and 36 deletions
@@ -51,6 +51,10 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
attendees: EventPerson[] = [];
scrollToBottomBtn = false;
longPressActive = false;
showMessageOptions = false;
selectedMsgId:string;
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
constructor(
@@ -99,11 +103,37 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
})
}
deleteMessage(msgId:string){
let body = {
"roomId": this.roomId,
"msgId": msgId,
"asUser": false,
}
if(msgId){
this.alertService.confirmDeleteMessage(body);
}
else{
this.toastService.badRequest('Não foi possível apagar');
}
this.showMessageOptions = false;
this.selectedMsgId = "";
}
ngAfterViewInit() {
this.scrollChangeCallback = () => this.onContentScrolled(event);
window.addEventListener('scroll', this.scrollChangeCallback, true);
}
handlePress(id?:string){
this.selectedMsgId = id;
this.showMessageOptions = true;
}
handleClick(){
this.showMessageOptions = false;
this.selectedMsgId = "";
}
onContentScrolled(e) {
this.startPosition = e.srcElement.scrollTop;
let scroll = e.srcElement.scrollTop;