This commit is contained in:
tiago.kayaya
2021-09-08 15:02:14 +01:00
parent 26da3a85b7
commit 9ff7a588d8
2 changed files with 23 additions and 9 deletions
@@ -1,6 +1,6 @@
<ion-content class="options-container"> <ion-content class="options-container">
<div class="arrow-right"> <div class="arrow-right">
<button class="btn-no-color" (click)="close()"> <button class="btn-no-color" (click)="close('cancel')">
<ion-icon slot="end" class="arrow-right-icon" src='assets/images/icons-arrow-arrow-right.svg'></ion-icon> <ion-icon slot="end" class="arrow-right-icon" src='assets/images/icons-arrow-arrow-right.svg'></ion-icon>
</button> </button>
</div> </div>
@@ -8,7 +8,7 @@
<button (click)="leaveGroup()" class="btn-cancel" shape="round" >Sair do Grupo</button> <button (click)="leaveGroup()" class="btn-cancel" shape="round" >Sair do Grupo</button>
<button (click)="openChangeGroupName()" class="btn-cancel" shape="round" >Alterar nome do grupo</button> <button (click)="openChangeGroupName()" class="btn-cancel" shape="round" >Alterar nome do grupo</button>
<div class="solid"></div> <div class="solid"></div>
<button (click)="close()" full class="btn-cancel mobile-only" shape="round" >Cancelar</button> <button (click)="close('cancel')" full class="btn-cancel mobile-only" shape="round" >Cancelar</button>
<button (click)="deleteGroup()" class="btn-delete" shape="round">Apagar grupo</button> <button (click)="deleteGroup()" class="btn-delete" shape="round">Apagar grupo</button>
</div> </div>
</ion-content> </ion-content>
@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams, PopoverController } from '@ionic/angular'; import { ModalController, NavParams, PopoverController } from '@ionic/angular';
import { ChatService } from 'src/app/services/chat.service'; import { ChatService } from 'src/app/services/chat.service';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-chat-popover', selector: 'app-chat-popover',
@@ -16,6 +17,7 @@ export class ChatPopoverPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private navParams: NavParams, private navParams: NavParams,
private chatService: ChatService, private chatService: ChatService,
private toastService: ToastService,
) { ) {
this.roomId = this.navParams.get('roomId'); this.roomId = this.navParams.get('roomId');
} }
@@ -24,14 +26,14 @@ export class ChatPopoverPage implements OnInit {
console.log(this.roomId); console.log(this.roomId);
} }
close(){ close(action:any){
if( window.innerWidth <= 701){ if( window.innerWidth <= 701){
this.popoverController.dismiss('cancel'); this.popoverController.dismiss(action);
this.modalController.dismiss('cancel'); this.modalController.dismiss(action);
} }
else{ else{
this.popoverController.dismiss('cancel'); this.popoverController.dismiss(action);
this.modalController.dismiss('cancel'); this.modalController.dismiss(action);
} }
} }
@@ -48,16 +50,28 @@ export class ChatPopoverPage implements OnInit {
if(this.room.t === 'p'){ if(this.room.t === 'p'){
this.chatService.leaveGroup(body).subscribe(res=>{ this.chatService.leaveGroup(body).subscribe(res=>{
console.log(res); console.log(res);
this.close('leave');
},
(error)=>{
this.toastService.badRequest("Não foi possível sair do grupo")
},
()=>{
//loader.remove()
}); });
} }
else{ else{
this.chatService.leaveChannel(body).subscribe(res=>{ this.chatService.leaveChannel(body).subscribe(res=>{
console.log(res); console.log(res);
this.close('leave');
},
(error)=>{
this.toastService.badRequest("Não foi possível sair do grupo")
},
()=>{
//loader.remove()
}); });
} }
}); });
this.popoverController.dismiss('leave');
this.modalController.dismiss('leave');
} }
//Delete //Delete