diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index b5963e605..916f0f0cb 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -159,11 +159,6 @@ export class ChatPage implements OnInit { let t = this.showDateDuration(new Date()); - this.setStatus('away'); - /* if(this.dataService.get("newGroup")){ - this.openNewGroupPage(); - } */ - this.router.events.forEach((event) => { if (event instanceof NavigationStart && event.url.startsWith('/home/chat')) { if (this.dataService.get("newGroup")) { diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 1bbcebd38..b57bfadb8 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -596,11 +596,12 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { await modal.present(); modal.onDidDismiss().then(async res=>{ const data = res.data; + const roomId = this.roomId if(data.selected) { const loader = this.toastService.loading(); - const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({ + const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({ file:{ "name": res.data.selected.Assunto, "type": "application/webtrix", @@ -646,13 +647,15 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { async addFileToChat(types: typeof FileType[] ) { + const roomId = this.roomId + const file = await this.fileService.getFileFromDevice(types); const imageData = await this.fileToBase64Service.convert(file) const formData = new FormData(); formData.append("blobFile", file); - const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({ + const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": "application/img", "guid": '', @@ -807,48 +810,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { } - sliderOpts = { - zoom: false, - slidesPerView: 1.5, - spaceBetween: 20, - centeredSlides: true - }; - zoomActive = false; - zoomScale = 1; - - sliderZoomOpts = { - allowSlidePrev: false, - allowSlideNext: false, - zoom: { - maxRatio: 5 - }, - on: { - zoomChange: (scale, imageEl, slideEl) => { - this.zoomActive = true; - this.zoomScale = scale / 5; - this.changeDetectorRef.detectChanges(); - } - } - } - - async touchEnd(zoomslides: IonSlides, card) { - // Zoom back to normal - const slider = await zoomslides.getSwiper(); - const zoom = slider.zoom; - zoom.out(); - - // Card back to normal - card.el.style['z-index'] = 9; - - this.zoomActive = false; - this.changeDetectorRef.detectChanges(); - } - - touchStart(card) { - // Make card appear above backdrop - card.el.style['z-index'] = 11; - } - downloadFileMsg(msg: MessageService) { console.log('FILE TYPE', msg.file.type) this.downloadFile = ""; diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index fbff28265..0a02d3063 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -139,7 +139,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe setTimeout(() => { this.getRoomInfo(); }, 1000); - this.setStatus('online'); this.getChatMembers(); //this.getMessageDB(); @@ -226,7 +225,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } ngOnDestroy() { - this.setStatus('away'); window.removeEventListener('scroll', this.scrollChangeCallback, true); } @@ -307,15 +305,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } } - loadGroupMessages(roomId) { - this.showLoader = true; - this.chatService.getPrivateGroupMessages(this.roomId).subscribe(res => { - console.log(res); - let msgOnly = res['messages'].filter(data => data.t != 'au'); - this.showLoader = false; - }); - } - sendMessage() { this.wsChatMethodsService.getGroupRoom(this.roomId).send({}) } @@ -429,7 +418,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe popover.onDidDismiss().then(res => { console.log(res); if (res.data) { - this.loadGroupMessages(this.roomId); //this.getRoomInfo(); //this.modalController.dismiss(); }; @@ -470,7 +458,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe modal.onDidDismiss().then(() => { //this.getRoomInfo(); - this.loadGroupMessages(this.roomId) }); } @@ -563,7 +550,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe const lastphoto: any = await this.fileService.loadFiles(); const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto); - const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({ + const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": "application/img", "guid": '', @@ -621,6 +608,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } async addFileWebtrix() { + const roomId = this.roomId + const modal = await this.modalController.create({ component: SearchPage, cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop', @@ -637,7 +626,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe if(data.selected) { const loader = this.toastService.loading(); - const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({ + const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({ file:{ "name": res.data.selected.Assunto, "type": "application/webtrix", @@ -683,13 +672,15 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe async addFileToChat(types: typeof FileType[] ) { + const roomId = this.roomId + const file = await this.fileService.getFileFromDevice(types); const imageData = await this.fileToBase64Service.convert(file) const formData = new FormData(); formData.append("blobFile", file); - const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({ + const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": "application/img", "guid": '', @@ -810,48 +801,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } - sliderOpts = { - zoom: false, - slidesPerView: 1.5, - spaceBetween: 20, - centeredSlides: true - }; - zoomActive = false; - zoomScale = 1; - - sliderZoomOpts = { - allowSlidePrev: false, - allowSlideNext: false, - zoom: { - maxRatio: 5 - }, - on: { - zoomChange: (scale, imageEl, slideEl) => { - this.zoomActive = true; - this.zoomScale = scale / 5; - this.changeDetectorRef.detectChanges(); - } - } - } - - async touchEnd(zoomslides: IonSlides, card) { - // Zoom back to normal - const slider = await zoomslides.getSwiper(); - const zoom = slider.zoom; - zoom.out(); - - // Card back to normal - card.el.style['z-index'] = 9; - - this.zoomActive = false; - this.changeDetectorRef.detectChanges(); - } - - touchStart(card) { - // Make card appear above backdrop - card.el.style['z-index'] = 11; - } - downloadFileMsg(msg: MessageService) { console.log('FILE TYPE', msg.file.type) this.downloadFile = ""; diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 8faa411ec..97651efad 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -450,7 +450,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy const lastphoto: any = await this.fileService.loadFiles(); const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto); - const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({ + const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": "application/img", "guid": '', @@ -520,11 +520,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy await modal.present(); modal.onDidDismiss().then(async res=>{ const data = res.data; + const roomId = this.roomId if(data.selected) { const loader = this.toastService.loading(); - const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({ + const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({ file:{ "name": res.data.selected.Assunto, "type": "application/webtrix", @@ -570,13 +571,15 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy async addFileToChat(types: typeof FileType[] ) { + const roomId = this.roomId + const file = await this.fileService.getFileFromDevice(types); const imageData = await this.fileToBase64Service.convert(file) const formData = new FormData(); formData.append("blobFile", file); - const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({ + const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": "application/img", "guid": '', @@ -705,47 +708,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } - sliderOpts = { - zoom: false, - slidesPerView: 1.5, - spaceBetween: 20, - centeredSlides: true - }; - zoomActive = false; - zoomScale = 1; - sliderZoomOpts = { - allowSlidePrev: false, - allowSlideNext: false, - zoom: { - maxRatio: 5 - }, - on: { - zoomChange: (scale, imageEl, slideEl) => { - this.zoomActive = true; - this.zoomScale = scale / 5; - this.changeDetectorRef.detectChanges(); - } - } - } - - async touchEnd(zoomslides: IonSlides, card) { - // Zoom back to normal - const slider = await zoomslides.getSwiper(); - const zoom = slider.zoom; - zoom.out(); - - // Card back to normal - card.el.style['z-index'] = 9; - - this.zoomActive = false; - this.changeDetectorRef.detectChanges(); - } - - touchStart(card) { - // Make card appear above backdrop - card.el.style['z-index'] = 11; - } downloadFileMsg(msg: MessageService) { console.log('FILE TYPE', msg.file.type)