verification added on group option

This commit is contained in:
Eudes Inácio
2022-06-12 23:43:18 +01:00
parent 5534ea728f
commit 3c716ee3ea
@@ -101,6 +101,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
sessionStore = SessionStore sessionStore = SessionStore
groupAdminId = "";
constructor( constructor(
public wsChatMethodsService: WsChatMethodsService, public wsChatMethodsService: WsChatMethodsService,
@@ -164,7 +165,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
console.log(this.roomId) console.log(this.roomId)
this.loggedUser = this.loggedUserChat; this.loggedUser = this.loggedUserChat;
//setTimeout(() => { //setTimeout(() => {
this.getRoomInfo(); this.getRoomInfo()
//}, 1000); //}, 1000);
this.getChatMembers(); this.getChatMembers();
//this.getMessageDB(); //this.getMessageDB();
@@ -401,7 +402,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
async getRoomInfo() { async getRoomInfo() {
this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({}); this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({});
let room = await this.chatService.getRoomInfo(this.roomId).toPromise(); let room = await this.chatService.getRoomInfo(this.roomId).toPromise();
console.log('ROOM',room)
this.room = room['room']; this.room = room['room'];
this.groupAdminId = this.room.u._id;
if (this.room.name) { if (this.room.name) {
this.roomName = this.room.name.split('-').join(' '); this.roomName = this.room.name.split('-').join(' ');
} }
@@ -503,82 +506,86 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} }
async openGroupMessagesOptions() { async openGroupMessagesOptions() {
alert(this.groupAdminId)
if(SessionStore.user.ChatData.data.userId == this.groupAdminId) {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const enterAnimation = (baseEl: any) => { const wrapperAnimation = this.animationController.create()
const backdropAnimation = this.animationController.create() .addElement(baseEl.querySelector('.modal-wrapper')!)
.addElement(baseEl.querySelector('ion-backdrop')!) .keyframes([
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); { offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
const wrapperAnimation = this.animationController.create() return this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!) .addElement(baseEl)
.keyframes([ .easing('ease-out')
{ offset: 0, opacity: '1', right: '-100%' }, .duration(500)
{ offset: 1, opacity: '1', right: '0px' } .addAnimation([backdropAnimation, wrapperAnimation]);
]); }
return this.animationController.create() const leaveAnimation = (baseEl: any) => {
.addElement(baseEl) return enterAnimation(baseEl).direction('reverse');
.easing('ease-out') }
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse'); /* const popover = await this.popoverController.create({
component: MessagesOptionsPage,
componentProps: {
roomId: this.dm._id,
},
cssClass: 'messages-options',
event: ev,
translucent: true,
});
return await popover.present(); */
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: ChatPopoverPage,
cssClass: 'model profile-modal search-submodal',
componentProps: {
roomId: this.roomId,
members: this.members,
}
});
await modal.present();
modal.onDidDismiss().then(res => {
if (res.data == 'leave') {
this.getRoomInfo();
this.closeAllDesktopComponents.emit();
this.showEmptyContainer.emit();
this.wsChatMethodsService.hidingRoom(this.roomId);
}
else if (res.data == 'delete') {
this.closeAllDesktopComponents.emit();
this.showEmptyContainer.emit();
}
else if (res.data == 'cancel') {
}
else if (res.data == 'edit') {
//this.closeAllDesktopComponents.emit();
this.openEditGroupPage.emit(this.roomId);
}
else {
this.roomName = res.data.name.split('-').join(' ');
};
});
} }
/* const popover = await this.popoverController.create({
component: MessagesOptionsPage,
componentProps: {
roomId: this.dm._id,
},
cssClass: 'messages-options',
event: ev,
translucent: true,
});
return await popover.present(); */
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: ChatPopoverPage,
cssClass: 'model profile-modal search-submodal',
componentProps: {
roomId: this.roomId,
members: this.members,
}
});
await modal.present();
modal.onDidDismiss().then(res => {
if (res.data == 'leave') {
this.getRoomInfo();
this.closeAllDesktopComponents.emit();
this.showEmptyContainer.emit();
this.wsChatMethodsService.hidingRoom(this.roomId);
}
else if (res.data == 'delete') {
this.closeAllDesktopComponents.emit();
this.showEmptyContainer.emit();
}
else if (res.data == 'cancel') {
}
else if (res.data == 'edit') {
//this.closeAllDesktopComponents.emit();
this.openEditGroupPage.emit(this.roomId);
}
else {
this.roomName = res.data.name.split('-').join(' ');
};
});
} }
openSendGroupMessageOptions(ev?: any) { openSendGroupMessageOptions(ev?: any) {